1
0
mirror of https://github.com/php/php-src.git synced 2026-04-27 01:48:26 +02:00
Commit Graph

127593 Commits

Author SHA1 Message Date
David CARLIER 20d8561ed4 fuzzer support for FreeBSD, getting opcache location
Closes GH-7926.
2022-01-18 15:04:42 +01:00
Remi Collet ac1c2dcd6a Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-7883 don't close not open file handle don't create a stream if file is not open
2022-01-18 14:50:29 +01:00
Remi Collet cdfc4d3596 Fix GH-7883 don't close not open file handle
don't create a stream if file is not open
2022-01-18 14:49:56 +01:00
Christoph M. Becker 58cbee1ce3 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-7902: mb_send_mail may delimit headers with LF only
2022-01-18 13:11:01 +01:00
Christoph M. Becker 69f6b09b2a Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7902: mb_send_mail may delimit headers with LF only
2022-01-18 13:09:52 +01:00
Christoph M. Becker 03816fba46 Fix GH-7902: mb_send_mail may delimit headers with LF only
Email headers are supposed to be separated with CRLF. Period.

We introduce a `CRLF` macro for better comprehensibility right away.

Closes GH-7907.
2022-01-18 13:08:08 +01:00
Tony Su 2c4b9e995a [JIT] Print out more meaningful warning message
* [JIT] Print out more meaningful warning message

When the setting value is out of range for jit_hot_loop, jit_hot_func,
jit_hot_return, and jit_hot_side_exit, current PHP only prints out
warning message like:
    Warning: Invalid "opcache.jit_hot_loop" setting.
    Should be between 0 and 256 in Unknown on line 0

With this small patch, PHP can print out more meaningful information,
and tell user default value will be used and correct value range, like
    Warning: Invalid "opcache.jit_hot_loop" setting; using default value instead.
    Should be between 0 and 255 in Unknown on line 0

This patch has been verified on my local machine.

Signed-off-by: Su, Tao <tao.su@intel.com>

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
Co-authored-by: Christoph M. Becker <cmbecker69@gmx.de>

Closes GH-7955.
2022-01-18 11:41:50 +01:00
Christoph M. Becker 3e32717c78 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-7896: Environment vars may be mangled on Windows
2022-01-17 23:46:15 +01:00
Christoph M. Becker 8d2ed194bf Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7896: Environment vars may be mangled on Windows
2022-01-17 23:45:49 +01:00
Christoph M. Becker 93a3c71eb4 Fix GH-7896: Environment vars may be mangled on Windows
When bug 77574[1] has been fixed, the fix only catered to variables
retrieved via `getenv()` with a `$varname` passed, but neither to
`getenv()` without arguments nor to the general import of environment
variables into `$_ENV` and `$_SERVER`.  We catch up on this by using
`GetEnvironmentStringsW()` in `_php_import_environment_variables()` and
converting the encoding to whatever had been chosen by the user.

[1] <https://bugs.php.net/bug.php?id=75574>

Closes GH-7928.
2022-01-17 23:44:41 +01:00
Christoph M. Becker ca6613abbd Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-7875: mails are sent even if failure to log throws exception
2022-01-17 22:33:14 +01:00
Christoph M. Becker 79bf39e917 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7875: mails are sent even if failure to log throws exception
2022-01-17 22:32:37 +01:00
Christoph M. Becker 478edcdacb Fix GH-7875: mails are sent even if failure to log throws exception
We explicitly check for an exception after the logging attempt, and
bail out in that case.

Co-authored-by: Tim Düsterhus <timwolla@googlemail.com>

Closes GH-7878.
2022-01-17 22:30:25 +01:00
Tyson Andre 944b6b6bbd Merge concatenated literal strings while compiling. (#7948)
The output of token_get_all is unaffected, so projects such as the userland
nikic/php-parser are unaffected.

Extensions such as nikic/php-ast which expose the internal php ast would see
literals be flattened, though.

This makes php significantly faster at parsing code such as
`$x = eval('return ' . var_export(str_repeat("\0", 100), true) . ';');`
and avoids the stack overflow from recursing 100000 times in
zend_eval_const_expr to process `'' . "\0" . '' . "\0" . ...`

Closes GH-7946

* Don't create binary op if unnecessary
* Update Zend/zend_ast.c

Co-authored-by: Nikita Popov <nikita.ppv@googlemail.com>
2022-01-16 13:31:58 -05:00
Dmitry Stogov 2b1f8abd87 Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fix exception handling
2022-01-14 17:25:14 +03:00
Dmitry Stogov 655e578e81 JIT: Fix exception handling
Fixes oss-fuzz #43618
2022-01-14 17:24:23 +03:00
Dmitry Stogov 024755ce17 Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fix trace type inference
2022-01-14 16:49:36 +03:00
Dmitry Stogov 797e091d06 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fix trace type inference
2022-01-14 16:49:26 +03:00
Dmitry Stogov ee8f9d75c0 JIT: Fix trace type inference
Fixes oss-fuzz #43597
2022-01-14 16:43:50 +03:00
Dmitry Stogov 313371a4e5 Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fix register allocation
2022-01-14 13:42:47 +03:00
Dmitry Stogov cd4e886840 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fix register allocation
2022-01-14 13:41:57 +03:00
Dmitry Stogov 079c5af9ec JIT: Fix register allocation
Fixes oss-fuzz #43598
2022-01-14 13:41:16 +03:00
Remi Collet 9406198008 Merge branch 'PHP-8.1'
* PHP-8.1:
  fix GH-7899 Regression in unpack for negative int value
2022-01-13 11:47:37 +01:00
Remi Collet e31c54d025 fix GH-7899 Regression in unpack for negative int value 2022-01-13 11:47:19 +01:00
Remi Collet d5b6c0de06 Merge branch 'PHP-8.1'
* PHP-8.1:
  fix GH-7899 Regression in unpack for negative int value
  Fix ext/zend_test/tests/observer_bug81430_2.phpt failure
  JIT: Fix incorrect flag check
2022-01-13 11:45:47 +01:00
Remi Collet 524ce90418 fix GH-7899 Regression in unpack for negative int value 2022-01-13 11:44:34 +01:00
Dmitry Stogov 7e6558edf1 Fix ext/zend_test/tests/observer_bug81430_2.phpt failure 2022-01-13 11:44:30 +01:00
Dmitry Stogov 78974a4776 JIT: Fix incorrect flag check
Fixes oss-fuzz #43538
2022-01-13 11:44:25 +01:00
Dmitry Stogov 9a165336bd Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix ext/zend_test/tests/observer_bug81430_2.phpt failure
2022-01-12 12:10:23 +03:00
Dmitry Stogov f6d7f78a9b Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix ext/zend_test/tests/observer_bug81430_2.phpt failure
2022-01-12 12:09:28 +03:00
Dmitry Stogov f7c3f6e7e2 Fix ext/zend_test/tests/observer_bug81430_2.phpt failure 2022-01-12 12:08:59 +03:00
Dmitry Stogov a8ccbafa6e Merge branch 'PHP-8.1'
* PHP-8.1:
  JIT: Fix incorrect flag check
2022-01-11 22:27:33 +03:00
Dmitry Stogov d136799ebf Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  JIT: Fix incorrect flag check
2022-01-11 22:24:30 +03:00
Dmitry Stogov 522406c0ec JIT: Fix incorrect flag check
Fixes oss-fuzz #43538
2022-01-11 22:23:44 +03:00
Dmitry Stogov 72cdb0af55 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix register allocation on x86
2022-01-11 13:04:12 +03:00
Dmitry Stogov 3b6d385794 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix register allocation on x86
2022-01-11 13:03:55 +03:00
Dmitry Stogov d8b0337cff Fix register allocation on x86
Fixes oss-fuzz #43119
2022-01-11 13:02:55 +03:00
Dmitry Stogov e1782c08bf Fix ASAN undefined behavior (unsigned char << 24)
ext/mbstring/libmbfl/filters/mbfilter_utf32.c:259:20: runtime error: left shift of 128 by 24 places cannot be represented in type 'int'
2022-01-11 09:13:22 +03:00
Joe Watkins 3c4c200602 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix TSRM ignoring done
2022-01-11 03:53:00 +01:00
Joe Watkins f9bf5f4877 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix TSRM ignoring done
2022-01-11 03:52:40 +01:00
Joe Watkins d7db5f6e21 Fix TSRM ignoring done 2022-01-11 03:51:06 +01:00
Christoph M. Becker ede1568967 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix GH-7867: FFI::cast() from pointer to array is broken
2022-01-11 00:00:31 +01:00
Christoph M. Becker 1632ebb542 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix GH-7867: FFI::cast() from pointer to array is broken
2022-01-10 23:59:55 +01:00
Christoph M. Becker 703cac33db Fix GH-7867: FFI::cast() from pointer to array is broken
Casting from pointer to array is special, so we must not fall back to
the general FFI casting.  There is a particular issue regarding the
size comparison, namely that the pointer size is always 8 for 64bit
architectures, but the size of an array is determined by its
declaration, so as is casting a pointer to an array with more than 8
elements would fail, but casting to an array with less than 9 elements
succeeds, but the internal pointer would point to some arbitrary
memory.

We fix this by properly supporting the cast.  An alternative would be
to deny this kind of cast generally, since it is not necessarily safe.
However, FFI isn't necessarily safe anyway.

We also check pointer/array type compatibility when casting.

Co-authored-by: Dmitry Stogov <dmitry@zend.com>

Closes GH-7876.
2022-01-10 23:58:39 +01:00
Nikita Popov 4543cd32ae Remove JMPZNZ opcode
While JMPZNZ can avoid execution of a separate JMP opcode in some
cases, it also prevents smart branch optimization, so creating
JMPZNZ may actually have a negative effect. It also adds additional
complexity for optimizations.

Drop JMPZNZ in favor of JMPZ+JMP or JMPNZ+JMP.

Closes GH-7857.
2022-01-10 22:07:10 +01:00
Dmitry Stogov 387c78a41f Merge branch 'PHP-8.1'
* PHP-8.1:
  Fix type inference
2022-01-10 21:55:25 +03:00
Dmitry Stogov 9824735aa4 Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0:
  Fix type inference
2022-01-10 21:54:14 +03:00
Dmitry Stogov 1f58365438 Fix type inference
Fixes oss-fuzz #43367
2022-01-10 21:53:35 +03:00
Christoph M. Becker 796511f324 Fix php-cgi name in usage info
Cf. <https://github.com/php/doc-en/issues/1312#issuecomment-1008214821>.

Closes GH-7916.
2022-01-10 18:21:09 +01:00
Dmitry Stogov 4d907a6b43 Merge branch 'PHP-8.1'
* PHP-8.1:
  Fixed NAN handling in SCCP
2022-01-10 19:42:29 +03:00