Commit Graph

131446 Commits

Author SHA1 Message Date
Ilija Tovilo
6f8261ed79
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix SKIPIF jit test
2023-10-04 15:06:32 +02:00
Ilija Tovilo
6e7e52de19
Fix SKIPIF jit test
JIT can be available but disabled, in which case the array offset 'jit' is still
available.
2023-10-04 15:05:41 +02:00
Ilija Tovilo
b13f743761
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Test opcache_invalidate() return value for deleted files
2023-10-03 15:56:16 +02:00
Ilija Tovilo
cad1660501
[skip ci] Test opcache_invalidate() return value for deleted files 2023-10-03 15:55:44 +02:00
Ilija Tovilo
6274970bee
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Invalidate path even if the file was deleted
2023-10-03 15:32:28 +02:00
Mikhail Galanin
f4ab494906
Invalidate path even if the file was deleted
Closes GH-12323
2023-10-03 15:31:39 +02:00
Dmitry Stogov
101bd1b199 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fixed GH-12262: Tracing JIT assertion crash when using phpstan
2023-10-03 13:25:22 +03:00
Dmitry Stogov
54452b4811 Fixed GH-12262: Tracing JIT assertion crash when using phpstan 2023-10-03 13:22:33 +03:00
Niels Dossche
6aa20956fb Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Ignore optional warning output in test
2023-10-02 22:55:28 +02:00
Niels Dossche
6cf76d552e Ignore optional warning output in test
Due to the greedy behaviour of regex, we can't seem to use %A?
Use a for loop with a marker instead to ignore module startup warnings.
2023-10-02 22:53:39 +02:00
Niels Dossche
87cd401aaf Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix test under older CI configurations
2023-10-02 21:52:52 +02:00
Niels Dossche
b140f6e9f8 Fix test under older CI configurations 2023-10-02 21:52:44 +02:00
Niels Dossche
28a909d40a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix #80092: ZTS + preload = segfault on shutdown
2023-10-02 19:37:09 +02:00
Niels Dossche
bdc87b0f66 Fix #80092: ZTS + preload = segfault on shutdown
After preloading has executed, the executor globals for class_table and
function_table are still referring to the values during preloading.
If no request happens after that then these values will remain dangling
pointers. If then the -v option on CLI or -h option (and possibly
others) on CGI is provided, there is a double free.
Fix it by nulling the pointers explicitly after preloading has finished
to fix it for all SAPIs.

Closes GH-12311.
2023-10-02 19:33:41 +02:00
Anatol Belski
1934da0a81 NEWS: Added note about #11891
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2023-09-30 19:18:25 +02:00
Anatol Belski
e181af7018 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  NEWS: Added note about #11891
2023-09-30 19:17:36 +02:00
Anatol Belski
a1225f35bb NEWS: Added note about #11891
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2023-09-30 19:16:42 +02:00
Niels Dossche
77f44b2281 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Apply SimpleXML iterator fixes only on master
2023-09-30 17:53:57 +02:00
Niels Dossche
b842ea4fa8 Apply SimpleXML iterator fixes only on master
Many methods in SimpleXML reset the iterator when called. This has the
consequence that mixing these operations with loops can cause infinite
loops, or the loss of iteration data.
Some people may however rely on the resetting behaviour. To prevent
unintended breaks in stable branches, let's only apply the fix to master.

This reverts GH-12193, GH-12229, GG-12247 for stable branches while
keeping them on master, adding a note in UPGRADING as well.
2023-09-30 17:48:05 +02:00
Anatol Belski
4b22cb213a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  fileinfo: Backport svg detection patch
2023-09-30 16:26:24 +02:00
usarise
1f5bea3452 fileinfo: Backport svg detection patch 2023-09-30 16:17:03 +02:00
Niels Dossche
0f5b382528 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Revert "Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT"
2023-09-30 01:27:06 +02:00
Niels Dossche
643c4ba417 Revert "Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT"
Although it passes CI on 8.1, it causes CI failures in the JIT on 8.2 and
higher.
See https://github.com/php/php-src/actions/runs/6357716718/job/17269225001

This reverts commit e72fc12058.
2023-09-30 01:25:48 +02:00
Niels Dossche
d7a7309b53 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
  Fix type error on XSLTProcessor::transformToDoc return value with SimpleXML
2023-09-30 00:10:35 +02:00
Niels Dossche
e72fc12058 Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
This test triggers narrowing for two ops: first ZEND_ADD_ARRAY_ELEMENT,
and then ZEND_ASSIGN.

The type inference happens in the following order:
1) The ZEND_ADD_ARRAY_ELEMENT infers type 0x40e04080 (packed flag is set),
   arr_type=0 at this point because it hasn't been set by ZEND_INIT_ARRAY yet.
2) The ZEND_INIT_ARRAY infers type 0x40804080
3) The ZEND_ADD_ARRAY_ELEMENT infers type 0x40e04080, arr_type=0x40804080,
   which does not have the packed flag set while the existing result of
   ZEND_ADD_ARRAY_ELEMENT has the packed flag set.

This seems to occur because of the phi node introduced by the while
loop. If I remove the loop the problem goes away.

As Arnaud noted, this seems to be caused by a too wide type inference
for arr_type==0. We should keep the invariant that if x>=y then
key_type(x) >= key_type(y).
If we write the possible results down in a table we get:

```
arr_type           resulting key type
---------------    --------------------------------------------------------------------------
HASH_ONLY	-> MAY_BE_ARRAY_NUMERIC_HASH
PACKED_ONLY	-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
HASH || PACKED	-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
0		-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
```

As we can see, `HASH_ONLY > 0` but
`MAY_BE_ARRAY_NUMERIC_HASH < MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED`,
which violates the invariant.
Instead if we modify the zero case to have MAY_BE_ARRAY_NUMERIC_HASH instead,
we get the following table which satisfies the invariant.

```
arr_type           resulting key type
---------------    --------------------------------------------------------------------------
HASH_ONLY	-> MAY_BE_ARRAY_NUMERIC_HASH
PACKED_ONLY	-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
HASH || PACKED	-> MAY_BE_ARRAY_NUMERIC_HASH | MAY_BE_ARRAY_PACKED (== MAY_BE_ARRAY_KEY_LONG)
0		-> MAY_BE_ARRAY_NUMERIC_HASH
```

Broke in 1ffbb73.
Closes GH-10294.
2023-09-30 00:08:32 +02:00
Niels Dossche
2a7f23e9b9 Fix type error on XSLTProcessor::transformToDoc return value with SimpleXML
The return type is wrong. You can also use this method with SimpleXML.
In fact, PHP provides a way that even third party libraries can hook
into its XML handling. Therefore, we cannot even use the
SimpleXML|DOMDocument|false union type as third party extensions may
extend the possibilities.

Broke in 8.1 in 1b35056a33.

Closes GH-12315.
2023-09-30 00:03:42 +02:00
twosee
90707f33e1
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix socket_export_stream() with wrong protocol
2023-09-29 18:33:59 +08:00
twosee
b5da98b972
Fix socket_export_stream() with wrong protocol
Closes GH-12310.
2023-09-29 18:33:12 +08:00
Niels Dossche
19886d3af5 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Restore old namespace reconciliation behaviour
2023-09-27 22:33:45 +02:00
Niels Dossche
e127f87114 Restore old namespace reconciliation behaviour
The xmlDOMWrapReconcileNamespaces method we used to fix the namespace
corruption issues in 8.1.21/8.2.8 caused regressions.
Primarily, there is a similar corruption that the xmlReconciliateNs method
used to have in which a namespace is suddenly shifted
(SAML-Toolkits/php-saml#562) and the side-effect of removing redundant
namespaces causes problems when a specific serialization is required.

Closes GH-12308.
2023-09-27 22:32:01 +02:00
Niels Dossche
741dc80d0b Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11997: ctype_alnum 5 times slower in PHP 8.1 or greater
  Fix GH-12297: PHP Startup: Invalid library (maybe not a PHP library) 'mysqlnd.so' in Unknown on line
2023-09-26 21:44:00 +02:00
Niels Dossche
07811b6390 Fix GH-11997: ctype_alnum 5 times slower in PHP 8.1 or greater
Currently, a common function is used where a function pointer gets
passed to check the character class type. If we instead use a macro, the
macro version of these character class type checkers can be used. While
this gives only a minor speed-up for glibc-based systems, on Alpine this
gives a multi-facor speed-up

This is essentially a manual revert of dc80ea7e38.

Full discussion in GH-11997.

Closes GH-12300.
2023-09-26 21:42:41 +02:00
Niels Dossche
14fc3d1566 Fix GH-12297: PHP Startup: Invalid library (maybe not a PHP library) 'mysqlnd.so' in Unknown on line
On some configurations, the COMPILE_DL_MYSQLND must come from config.h.
If it isn't set, the get_module function won't be exposed, resulting in
a failure when trying to load the library.
It's the same issue ext/fileinfo had a while back that was fixed in
b0ba368d5.

Closes GH-12299.
2023-09-26 21:41:45 +02:00
Niels Dossche
9c37a02c54 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12167 and GH-12169: Unable to get comment or processing instruction contents in SimpleXML
2023-09-25 19:48:49 +02:00
Niels Dossche
82a84d0b7b Fix GH-12167 and GH-12169: Unable to get comment or processing instruction contents in SimpleXML
Closes GH-12289.
2023-09-25 19:47:09 +02:00
David Carlier
4bfd3459fe Merge branch 'PHP-8.1' into PHP-8.2 2023-09-24 15:19:02 +01:00
David Carlier
d65c80031a Fix GH-12190: stream_context_create with address and port at 0.
Prior to the 8.1 rewrite, inet_aton was used for ipv4 addresses
therefore addresses like `0` passed.
For the bindto's case where both ip and port are set as such, we discard
the address binding.

Close GH-12195
2023-09-24 15:17:53 +01:00
David Carlier
5df291e835 Merge branch 'PHP-8.1' into PHP-8.2 2023-09-24 08:04:30 +01:00
Thomas Hurst
d93800ec0f Fix GH-12273 - configure __builtin_cpu_init() check
__builtin_cpu_init() is documented as having a void return type.  It happens to
return int on gcc, but is void on clang.

Close GH-122274
2023-09-24 08:04:02 +01:00
David Carlier
36f78862c8 Merge branch 'PHP-8.1' into PHP-8.2 2023-09-23 20:12:41 +01:00
David Carlier
a80db7b52a Fix GH-12282: IntlDateFormatter::construct should throw an exception is the locale field has an invalid value.
Close GH-12282
2023-09-23 20:12:13 +01:00
Ilija Tovilo
88f6b5288f
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  support running testsuite with negative niceness (#11481)
2023-09-22 11:33:36 +02:00
divinity76
4f044e9238
support running testsuite with negative niceness (#11481)
* support running testsuite with negative niceness

a bug in the regex would break getNice() if the current niceness was negative, which would make the whole test fail.

Previously:
this would fail:
time sudo nice --adjustment=-19 ./php run-tests.php -j$(nproc) -x --offline ext/standard/tests/general_functions/proc_nice_basic.phpt --color --show-all

and this would work: 
time sudo ./php run-tests.php -j$(nproc) -x --offline ext/standard/tests/general_functions/proc_nice_basic.phpt --color --show-all

* Update ext/standard/tests/general_functions/proc_nice_basic.phpt

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>

---------

Co-authored-by: Michael Voříšek <mvorisek@mvorisek.cz>
2023-09-22 11:33:25 +02:00
Ilija Tovilo
645ea22390
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix getpriority test with negative return value
2023-09-22 10:26:01 +02:00
Ilija Tovilo
181598d403
Fix getpriority test with negative return value
Negative return values are valid and denote higher priority.

https://man7.org/linux/man-pages/man2/setpriority.2.html
2023-09-22 10:25:15 +02:00
Niels Dossche
5b62df1d85 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
2023-09-21 20:04:24 +02:00
Niels Dossche
ca5f9e812a [ci skip] NEWS
Remove redundant whitespace
2023-09-21 20:03:59 +02:00
Niels Dossche
2aea9be3ea Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix memory leak when calling xml_parse_into_struct() twice
  Fix return type of stub of xml_parse_into_struct()
2023-09-21 19:51:14 +02:00
Niels Dossche
30f26b587a Fix memory leak when calling xml_parse_into_struct() twice
Closes GH-12254.
2023-09-21 19:49:46 +02:00
Niels Dossche
b1d9a8d321 Fix return type of stub of xml_parse_into_struct()
Closes GH-12253.
2023-09-21 19:48:40 +02:00