Commit Graph

15496 Commits

Author SHA1 Message Date
David Carlier
b710f6f77f Merge branch 'PHP-8.2' into PHP-8.3 2024-02-04 19:43:28 +00:00
David Carlier
7096eff91d Fix NEWS entry for GH-13315.
Close GH-13325
2024-02-04 19:41:55 +00:00
Jakub Zelenka
ae44ab47a7
Merge branch 'PHP-8.2' into PHP-8.3 2024-02-04 12:00:36 +00:00
Jakub Zelenka
bc30ae4f04
Fix bug #75712: getenv in php-fpm should not read $_ENV, $_SERVER
Closes GH-13195
2024-02-04 11:58:18 +00:00
David Carlier
6842d3c03a Merge branch 'PHP-8.2' into PHP-8.3 2024-02-03 13:07:51 +00:00
David Carlier
d91224cd2f Fix GH-13309 and GH-13310: array hashes comparison, wrong buffer len calculation.
php_array_key_compare_string_case_unstable_i has a typo for the second
operand resulting in a wrong buffer size calculation.

Issue reported by @AlexRudyuk

Close GH-13315
2024-02-03 13:07:15 +00:00
Niels Dossche
7e3a6a1b42 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  ext/curl: Fix failing tests due to string changes in libcurl 8.6.0
2024-01-31 21:58:59 +01:00
Ayesh Karunaratne
404803577d ext/curl: Fix failing tests due to string changes in libcurl 8.6.0
Upstream libcurl 8.6.0 contains a change[^1] that caused a test failure.
This fixes it by updating the test's `EXPECTF` to use a regex to account for both string patterns.

[^1]: https://github.com/curl/curl/commit/45cf4755e71f#diff-a8a54563608f8155973318f4ddb61d7328dab512b8ff2b5cc48cc76979d4204cL1683

Closes GH-13293.
2024-01-31 21:58:27 +01:00
Ilija Tovilo
d65c395049
Fix instable array during in-place modification in uksort
The array isn't just observable if the array has RCn, but also if it is inside a
reference that is RCn. By-ref parameters are always RCn and as such always
observable.

Fixes GH-13279
Closes GH-13285
2024-01-31 19:25:30 +01:00
Eric Mann
5094a636ae
PHP-8.3 is now for PHP-8.3.4-dev 2024-01-30 12:42:45 -08:00
Pierrick Charron
0454f4ade4
PHP-8.2 is now for PHP 8.2.17-dev 2024-01-30 12:43:37 -05:00
Alex Dowad
d978ade0a9 Retroactively add NEWS entry for ec348a12
Thanks to Kalle Sommer Nielsen for suggesting that the change in
ec348a12 should have been called out in NEWS.
2024-01-28 20:39:23 +02:00
Niels Dossche
b76ef301a0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-10614: imagerotate will turn the picture all black, when rotated 90
2024-01-26 18:16:21 +01:00
Niels Dossche
f26dd1354b Fix GH-10614: imagerotate will turn the picture all black, when rotated 90
This is a backport of the upstream libgd PR that was recently committed
[1].

[1] https://github.com/libgd/libgd/pull/862

Closes GH-13246.
2024-01-26 18:15:52 +01:00
Niels Dossche
78986a6734 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-10344: imagettfbbox(): Could not find/open font UNC path
  Fix GH-13037: PharData incorrectly extracts zip file
2024-01-25 20:07:33 +01:00
Niels Dossche
4a48729438 Fix GH-10344: imagettfbbox(): Could not find/open font UNC path
libgd uses an incorrect absolute path check in gdft.c.
It checks if either the path starts with a '/' (only valid on Posix
btw), or whether it contains something of the form C:\ or C:/.
However, this overlooks the possibility of using UNC paths on Windows.
As we already do PHP-specific stuff with VCWD_ macros, use
IS_ABSOLUTE_PATH to check for an absolute path which will take into
account UNC paths as well.

Closes GH-13241.
2024-01-25 20:06:28 +01:00
Niels Dossche
ba80372a58 Fix GH-13037: PharData incorrectly extracts zip file
The code currently assumes that the extra field length of the central
directory entry and the local entry are the same, but that's not the
case. For example, the "Extended Timestamp extra field" differs in size
for local vs central directory entries. This causes the file contents
offset to be incorrect because it is based on the central directory
length instead of the local entry length. Fix it by reading the local
entry and getting the size from there as well as checking consistency
for the file name length.

Closes GH-13045.
2024-01-25 20:05:45 +01:00
Niels Dossche
31e8cea1d6 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
2024-01-24 17:48:57 +01:00
Niels Dossche
d417072ebe Fix GH-13232: Segmentation fault will be reported when JIT is off but JIT_debug is still on
Closes GH-13234.
2024-01-24 17:47:40 +01:00
Niels Dossche
d50393e242 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12504: Corrupted session written when there's a fatal error in autoloader
2024-01-22 22:02:28 +01:00
Niels Dossche
7f7031eb72 Fix GH-12504: Corrupted session written when there's a fatal error in autoloader
For details and reasoning, see [1] and following.

[1] https://github.com/php/php-src/issues/12504#issuecomment-1790870399

Closes GH-13207.
2024-01-22 21:59:11 +01:00
Remi Collet
fae27cd8c4
NEWS 2024-01-22 10:59:34 +01:00
Remi Collet
242f89283e
NEWS 2024-01-22 10:59:00 +01:00
Niels Dossche
c2c1710ed7 Fix GH-13177: PHP 8.3.2: final private constructor not allowed when used in trait
zend_compile has an exception to this rule for constructors using
`zend_is_constructor`, which compares the function name to
`__construct`. Sadly, `zend_is_constructor` is not a public API, but we
can just do the string compare ourselves.

Closes GH-13179.
2024-01-19 23:36:36 +01:00
Niels Dossche
87728105b9 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12107: When running a stored procedure (that returns a result set) twice, PHP crashes
2024-01-19 23:35:23 +01:00
Niels Dossche
0d21a8dcb5 Fix GH-12107: When running a stored procedure (that returns a result set) twice, PHP crashes
Closes GH-12771.
2024-01-19 23:34:12 +01:00
Niels Dossche
120bd364aa Fix crashes with entity references and predefined entities
Closes GH-13004.
2024-01-17 19:41:22 +01:00
Ilija Tovilo
42cbace1ad
Fix range inference since "proper-range-semantics" RFC
* Arrays returned from range are never empty
* When step is a double value representable by a long, it is coerced implicitly.
  As such, passing a double step no longer guarantees that the result is a
  non-int array.

Closes GH-13166
2024-01-17 15:42:17 +01:00
Niels Dossche
47454cb771 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13071: Copying large files using mmap-able source streams may exhaust available memory and fail
2024-01-16 23:46:43 +01:00
Niels Dossche
5e9e9c9d51 Fix GH-13071: Copying large files using mmap-able source streams may exhaust available memory and fail
Commit 5cbe5a538c disabled chunking for all writes to streams. However,
user streams have a callback where code is executed on data that is
subject to the memory limit. Therefore, when using large writes or
stream_copy_to_stream/copy the memory limit can easily be hit with large
enough data.

To solve this, we reintroduce chunking for userspace streams.
Users have control over the chunk size, which is neat because
they can improve the performance by setting the chunk size if
that turns out to be a bottleneck.

In an ideal world, we add an option so we can "ask" the stream whether
it "prefers" chunked writes, similar to how we have
php_stream_mmap_supported & friends. However, that cannot be done on
stable branches.

Closes GH-13136.
2024-01-16 23:44:58 +01:00
Niels Dossche
764360b1b0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13097: Anonymous class reference in trigger_error / thrown Exception
2024-01-16 21:06:03 +01:00
Niels Dossche
2cde4b2ea4 Fix GH-13097: Anonymous class reference in trigger_error / thrown Exception
Closes GH-13153.
2024-01-16 21:05:04 +01:00
Niels Dossche
83c8d02602 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix missing error check in curl_multi_init()
2024-01-16 19:36:03 +01:00
divinity76
9814d4a191 Fix missing error check in curl_multi_init()
Closes GH-13157.
2024-01-16 19:35:36 +01:00
Saki Takamachi
f234104379
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13119 (#13125)
2024-01-17 01:14:33 +09:00
SakiTakamachi
fa751c7dd6
Fix GH-13119 (#13125)
Fixed an issue where pdo_firebird float and double type values were wrong.

Changed from using `%F` format with `zend_strpprintf` to using `%H` format with
`zend_strpprintf_unchecked`.

Fixes GH-13119
Closes GH-13125
2024-01-17 01:12:24 +09:00
David Carlier
719c74e919 Merge branch 'PHP-8.2' into PHP-8.3 2024-01-14 18:24:08 +00:00
David Carlier
5e2a586c9a ext/openssl: fix libressl build.
Close GH-12919
2024-01-14 18:23:18 +00:00
Ilija Tovilo
ed64949d12
strtok is not comptime()
Fixes GH-13145
Closes GH-13148
2024-01-14 19:12:41 +01:00
Tim Düsterhus
f2f070a897
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  random/standard: Correctly handle broken engines in php_array_pick_keys (#13138)
2024-01-14 13:03:33 +01:00
Tim Düsterhus
97c6da1dec
random/standard: Correctly handle broken engines in php_array_pick_keys (#13138) 2024-01-14 13:01:29 +01:00
Jakub Zelenka
1c7dc0f300
Merge branch 'PHP-8.2' into PHP-8.3 2024-01-11 16:48:03 +00:00
Jakub Zelenka
b04b09ef56
Fix GH-12996: Incorrect SCRIPT_NAME with Apache ProxyPassMatch when plus in path
Closes GH-13072
2024-01-11 16:47:08 +00:00
Peter Kokot
04954f6b2c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Set libtool tag per command instead of global one
2024-01-10 09:13:39 +01:00
Jan Palus
d57a7767a2 Set libtool tag per command instead of global one
Global --tag=CC defined in configure.ac is not correct in all cases. For example
linking objects that were compiled from C++ sources needs to be done with C++
compiler, however for link mode libtool will prefer compiler indicated with
--tag.

Fixes GH-12349
2024-01-10 09:09:45 +01:00
David Carlier
7d238bf2d5 Merge branch 'PHP-8.2' into PHP-8.3 2024-01-09 22:01:15 +00:00
David Carlier
1e464e5b55 ext/gd: Fix GH-13082
Issue occur when compiling with recent clang releases (> 13) and
 with the '-Os' optimisation level, after using
`imageloadfont` which returns a proper GdFont class leads to
 a subtle bug when attempting to use via the imagefont* function.
2024-01-09 22:01:00 +00:00
Niels Dossche
1d6f344bea Fix GH-13094: range(9.9, '0') causes segmentation fault
`start_type + end_type < 2*IS_STRING` is not right, in this test case
the types are start_type==5 (IS_DOUBLE), end_type==7 (IS_ARRAY).
The IS_ARRAY type is a sentinel to disambiguate single-byte strings.
The path must be taken when one of the types is not a string nor a
single-byte string. Therefore, use < IS_STRING with an OR condition.

Closes GH-13105.
2024-01-09 22:11:45 +01:00
Arnaud Le Blanc
3a237b96a0 [ci skip] NEWS 2024-01-05 19:47:08 +01:00
Arnaud Le Blanc
29cb814836 [ci skip] NEWS 2024-01-05 19:45:18 +01:00
Niels Dossche
7525e690f6 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix #71465: PHAR doesn't know about litespeed
2024-01-03 21:34:59 +01:00
Niels Dossche
85dbbe19e2 Fix #71465: PHAR doesn't know about litespeed
We should perhaps look into a generic system to ask the SAPI whether
a feature should be supported or not. Or, we should look into making
a denylist instead of an allowlist.
Anyway, let's not try doing anything fancy on stable branches.

Closes GH-13070.
2024-01-03 21:31:09 +01:00
Jakub Zelenka
d33a534863
PHP-8.3 is now for PHP-8.3.3-dev 2024-01-02 15:50:36 +00:00
Sergey Panteleev
5d79c1b74d
PHP-8.2 is now for PHP 8.2.16-dev 2024-01-02 16:42:14 +03:00
Niels Dossche
e787790cfc Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix #77432: Segmentation fault on including phar file
2024-01-01 13:46:27 +01:00
Niels Dossche
1edcfccdca Fix #77432: Segmentation fault on including phar file
phar_get_pharfp() can return NULL. In this case this is because the
stream gets closed by the include code in the engine. However, the phar
entry is still cached, so when the next include happens the engine tries
to read from a closed (and nullified) stream.
Use the same fix as in phar_open_entry_fp(): take into account that the
phar_get_pharfp() can return NULL and in that case reopen the phar
archive.

Closes GH-13056.
2024-01-01 13:45:40 +01:00
Niels Dossche
02758ec376 [ci skip] Fixes in NEWS 2023-12-27 23:26:37 +01:00
Niels Dossche
42575ac966 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12974: Apache crashes on shutdown when using pg_pconnect()
2023-12-27 20:16:32 +01:00
Niels Dossche
77ac1e8592 Fix GH-12974: Apache crashes on shutdown when using pg_pconnect()
On ZTS, the global variables are stored in dynamically allocated memory.
When the module gets shut down this memory is released. After the module
is shut down, only then are the persistent resources cleared. Normally
this isn't an issue, but pgsql and odbc refer to the globals to modify
some counters, after the globals have been freed.
Fix this by guarding the modification.

Closes GH-13032.
2023-12-27 20:14:23 +01:00
Niels Dossche
93951cf5ab Fix GH-13012: DOMNode::isEqualNode() is incorrect when attribute order is different
Attributes (and namespace declarations) have to be compared in an
unordered way.

Closes GH-13017.
2023-12-27 02:22:23 +01:00
David Carlier
0c8e45e71f Merge branch 'PHP-8.2' into PHP-8.3 2023-12-23 17:15:06 +00:00
David Carlier
d98a45d08c ext/pgsql: pgsql.allow_persistent, no need to use such large type for boolean state.
also ext/odbc, simplifying odd comparison with non persistent connections.

Close GH-12976
2023-12-23 17:14:48 +00:00
Niels Dossche
5f69232b53 Revert "Fix crashes with entity references and predefined entities"
This reverts commit 3fa5af8496.
2023-12-23 17:31:18 +01:00
Niels Dossche
3fa5af8496 Fix crashes with entity references and predefined entities
There's two issues here:
- freeing of predefined entity declaration crashes (unique to 8.3 & master)
- using multiple entity references for a single entity declaration crashes
  (since forever)

The fix for the last issue is fairly easy to do on 8.3, but may require a
slightly different approach on 8.2. Therefore, for now this is 8.3-only.

Closes GH-13004.
2023-12-23 17:00:57 +01:00
Niels Dossche
8e8d5ce240 Fix crash in adoptNode with attribute references
I forgot to also update the document reference of attributes, so when
there is no document reference anymore from a variable, but still an
attribute, this can crash. Fix it by also updating the document
references for attributes.

Closes GH-13002.
2023-12-23 16:58:11 +01:00
Niels Dossche
b2d778c36e Fix crash when toggleAttribute() is used without a document 2023-12-22 21:12:59 +01:00
David Carlier
f20edf0fb3 Merge branch 'PHP-8.2' into PHP-8.3 2023-12-22 17:26:20 +00:00
David Carlier
6a447e7437 GH-12943 ext/intl accept C as acceptable locale argument.
Close GH-12955
2023-12-22 17:26:09 +00:00
Niels Dossche
b1206ea965 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12980: tidynode.props.attribute is missing "Boolean Attributes" and empty attributes
2023-12-22 17:38:15 +01:00
Niels Dossche
b3f483db2e Fix GH-12980: tidynode.props.attribute is missing "Boolean Attributes" and empty attributes
Closes GH-12993.
2023-12-22 17:37:34 +01:00
Peter Kokot
71e002b38e Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add cross-compiling 3rd argument to AC_RUN_IFELSE
2023-12-22 16:34:42 +01:00
Peter Kokot
de5557b02f Add cross-compiling 3rd argument to AC_RUN_IFELSE
Autotools emits warning if 3rd argument is empty. Call is wrapped in the
AC_CACHE_CHECK with php_cv_* cache variable name according to the docs.

Closes GH-12966
2023-12-22 16:24:40 +01:00
Niels Dossche
c3f6579f93 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES
2023-12-22 15:07:10 +01:00
SakiTakamachi
b333164423 Fix GH-12969: Fixed PDO::getAttribute() to get PDO::ATTR_STRINGIFY_FETCHES
Partial backport of GH-12793.

Closes GH-12970.
2023-12-22 15:06:01 +01:00
David Carlier
a2068ef47b Fix GH-12999: zend_strnlen build fix when platform misses strnlen support.
fix from @rainerjung
2023-12-22 14:00:14 +00:00
Jakub Zelenka
3c176d4189
Merge branch 'PHP-8.2' into PHP-8.3 2023-12-21 16:43:16 +00:00
Jakub Zelenka
7c4763ab8b
Fix GH-12987: openssl_csr_sign might leak new cert on error
Closes GH-12988
2023-12-21 16:42:09 +00:00
Niels Dossche
87c906c33a Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12905: FFI::new interacts badly with observers
2023-12-19 15:59:35 +01:00
Niels Dossche
c727f29942 Fix GH-12905: FFI::new interacts badly with observers
Because these functions are copied and not properly registered (which we
can't), the observer code doesn't add the temporaries on startup.
Add them via a callback during startup.

Closes GH-12906.
2023-12-19 15:59:01 +01:00
Niels Dossche
fc82c27a3d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12953: SSA integrity verification failed when loading composer classmaps with more than 11k elements
2023-12-18 13:15:19 +01:00
Niels Dossche
7585cf6952 Fix GH-12953: SSA integrity verification failed when loading composer classmaps with more than 11k elements
This is a false positive. The cycle detection code stops at 10.000
iterations. Instead of stopping at a fixed amount, make it more robust
by implementing Floyd's cycle detection algorithm.

Closes GH-12954.
2023-12-18 13:14:51 +01:00
Gina Peter Banyard
dcef7039e8
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  add PDO::ATTR_AUTOCOMMIT to getAttribute
  Fix GH-12767: Fixed to be able to change autocommit mode using setAttribute
2023-12-18 00:27:58 +00:00
SakiTakamachi
933dccb79b
Fix GH-12767: Fixed to be able to change autocommit mode using setAttribute
Signed-off-by: Gina Peter Banyard <girgias@php.net>
2023-12-18 00:26:32 +00:00
Niels Dossche
f75931ad9e Fix GH-12929: SimpleXMLElement with stream_wrapper_register can segfault
Move SimpleXML invalidation code after node checks

This is safe, i.e. the tree hasn't been modified yet, because either we
didn't call a libxml modification function yet, or xmlNewChild is called
with a NULL pointer, which makes it bail out and return NULL.

Closes GH-12947.
2023-12-17 11:51:42 +01:00
Niels Dossche
4fc336c784 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix getting the address of an uninitialized property of a SimpleXMLElement resulting in a crash
  Fix GH-12962: Double free of init_file in phpdbg_prompt.c
2023-12-17 11:50:42 +01:00
Niels Dossche
abf4c116b1 Fix getting the address of an uninitialized property of a SimpleXMLElement resulting in a crash
Closes GH-12945.
2023-12-17 11:47:11 +01:00
Niels Dossche
a6d17bffe1 Fix GH-12962: Double free of init_file in phpdbg_prompt.c
See GH-12962 for analysis.

Closes GH-12963.
2023-12-17 11:46:02 +01:00
Jakub Zelenka
1b8be9acf0
Merge branch 'PHP-8.2' into PHP-8.3 2023-12-15 14:13:41 +00:00
Jakub Zelenka
40ccc8ea7e
Fix GH-9698: stream_wrapper_register crashes with FFI\CData provided as class
Closes GH-12926
2023-12-15 14:11:56 +00:00
Ilija Tovilo
719236e3ec
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix SELinux mprotect execheap error due to mem adjacent to heap
2023-12-13 11:26:23 +01:00
Ilija Tovilo
7cf1a2ad9d
Fix SELinux mprotect execheap error due to mem adjacent to heap
It seems SELinux has a bug where memory directly adjacent to the heap is
interpreted as heap memory. Dodge this issue by leaving some space between the
heap and memory suggested by find_prefered_mmap_base.

See GH-12932
See https://bugzilla.kernel.org/show_bug.cgi?id=218258
Closes GH-12942
2023-12-13 11:25:48 +01:00
Niels Dossche
cd179171cc Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12936: hash() function hangs endlessly if using sha512 on strings >= 4GiB
2023-12-12 19:57:47 +01:00
Niels Dossche
2b8c00850b Fix GH-12936: hash() function hangs endlessly if using sha512 on strings >= 4GiB
There's two problems:
- Some loops used `unsigned int` instead of `size_t`.
- The 2*N-bit addition that is emulated using 2 N bit numbers has a bug:
  it first truncated the number to 32/64 bit and only then shifted. This
  resulted in the wrong length info stored inside the resulting hash.

Closes GH-12937.
2023-12-12 19:57:06 +01:00
Ilija Tovilo
e83a5683f9
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix zend_jit_undefined_long_key overwriting dim when dim == result
2023-12-11 15:07:44 +01:00
Ilija Tovilo
623da03845
Fix zend_jit_undefined_long_key overwriting dim when dim == result
Fixes oss-fuzz #64727
Closes GH-12900
2023-12-11 15:07:09 +01:00
Niels Dossche
ed40004139 [ci skip] NEWS 2023-12-08 17:19:17 +01:00
Ilija Tovilo
a559a5e530
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix max_execution_time with cli-server router script
2023-12-07 16:13:21 +01:00
Ilija Tovilo
299c3ba89e
Fix max_execution_time with cli-server router script
When the cli-server specifies a router script, we run it using
zend_execute_scripts instead of php_execute_script, because the former preserves
the return value of the script. However, php_execute_script also starts resets
the execution timer with the value from max_execution_time. If the timer has
previously been initialized with max_input_time, it will never be reset, and
thus trigger at the incorrect time.

Closes GH-12886
2023-12-07 16:11:48 +01:00
Niels Dossche
e679ab36b3 Fix GH-12854: 8.3 - as final trait-used method does not correctly report visibility in Reflection
Closes GH-12857.
2023-12-05 21:49:29 +01:00
Pierrick Charron
dc3641ea0f
PHP-8.2 is now for PHP 8.2.15-dev 2023-12-05 15:01:08 -05:00
Eric Mann
1fdf21fe84
PHP-8.3 is now for PHP 8.3.2-dev 2023-12-05 07:56:55 -08:00
Patrick Allaert
8f6610ce88
PHP-8.1 is now for PHP 8.1.28-dev
(If released one day!)
2023-12-05 15:05:00 +01:00
Máté Kocsis
b500ddd7a9
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix the default value of $fetchMode in PDO::pgsqlGetNotify()
2023-12-03 09:11:43 +01:00
Máté Kocsis
8387f2dfd4
Fix the default value of $fetchMode in PDO::pgsqlGetNotify() 2023-12-03 09:01:06 +01:00
Niels Dossche
addb6e463a Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-9348: FTP & SSL session reuse
2023-12-03 00:52:08 +01:00
Niels Dossche
ac8a58fab1 Fix GH-9348: FTP & SSL session reuse
The issue referenced here doesn't contain a reproducer, but I recently
received an email of a user with the exact same problem. I was able to
recreate the scenario locally using vsftpd and setting
`require_ssl_reuse=YES` in the vsftpd configuration.

It turns out that our session resumption code is broken. It only works a
single time: the first time a data connection opens. Subsequent data
connections fail to reuse the session. This is because on every data
connection a new session is negotiated, but the current code always
tries to reuse the (stale) session of the control connection.

To fix this, we use SSL_CTX_sess_set_new_cb() to setup a callback that
gets called every time a new session is negotiated. We take a strong
reference using SSL_get1_session() and store it in the ftpbuf_t struct.
Every time we open a data connection we'll take that session.
This works because every control connection has at most a single
associated data connection.

Also disable internal session caching storage to not fill the cache up
with useless sessions.

There is no phpt for this because PHP does not support enforcing SSL
session reuse.
It is however testable manually by setting up vsftpd and setting the
`require_ssl_reuse=YES` function from before.

Closes GH-12851.
2023-12-03 00:47:33 +01:00
Niels Dossche
b175ea4215 Fix GH-12826: Weird pointers issue in nested loops
This regressed in cd53ce838a.
The loop with `zend_hash_iterators_update` hangs forever because
`iter_pos` can't advance to idx. This is because the
`zend_hash_iterators_lower_pos` upper bound is `target->nNumUsed`,
but that is set to `source->nNumOfElements`.
That means that if there are holes in the array, we still loop over all
the buckets but the number of bucket slots will not match.
Fix it by changing the assignment.

Closes GH-12831.
2023-12-01 17:12:18 +01:00
Niels Dossche
c46fd35f7b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12838: [SOAP] Temporary WSDL cache files not being deleted
2023-12-01 17:11:43 +01:00
Niels Dossche
4eee81b509 Fix GH-12838: [SOAP] Temporary WSDL cache files not being deleted
If there are two users that can execute the script that caches a WSDL,
but the script is owned by a single user, then the caching code will
name the cached file with the file owner username and a hash of the uri.
When one of the two tries to rename the file created by the other
process, this does not work because it has no permission to do so.
This then leaves temporary files floating in the temp directory.

To fix the immediate problem, unlink the file after rename has failed.
On the long term, this has to be fixed by taking the username of the
process instead of the username of the file owner.

Closes GH-12841.
2023-12-01 17:10:58 +01:00
Ilija Tovilo
b7a468cd06
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix leak of call->extra_named_params on internal __call
2023-12-01 16:50:49 +01:00
Ilija Tovilo
f203edd3c5
Fix leak of call->extra_named_params on internal __call
Fixes GH-12835
Closes GH-12836
2023-12-01 16:49:16 +01:00
Jakub Zelenka
c74fc4c5b0
Merge branch 'PHP-8.2' into PHP-8.3 2023-12-01 14:47:57 +00:00
Jakub Zelenka
2303e76740
Merge branch 'PHP-8.1' into PHP-8.2 2023-12-01 14:45:48 +00:00
Patrick Prasse
df259f88da
Fix bug GH-12705: Segmentation fault in fpm_status_export_to_zval
Closes GH-12706
2023-12-01 14:43:58 +00:00
Niels Dossche
0e69329bb0 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add missing NULL checks for spl autoload table
  Add missing NULL pointer checks related to the previous call frame
2023-12-01 09:09:58 +01:00
Niels Dossche
9a69bb2d58 Add missing NULL checks for spl autoload table
Closes GH-12840.
2023-12-01 09:09:17 +01:00
Niels Dossche
5be5a3dfdb Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Test fixes for libxml2 2.12.0
2023-11-29 20:53:13 +01:00
Niels Dossche
061058a9b1 Test fixes for libxml2 2.12.0 2023-11-29 20:52:01 +01:00
David Carlier
b12c85293d Merge branch 'PHP-8.1' into PHP-8.2 2023-11-27 18:19:02 +00:00
ddv
3f57bd80f6 Fix phpGH-12763: PGSQL pg_untrace(): Argument #1 ($connection) must be of type resource or null, PgSql\Connection given. 2023-11-27 18:18:46 +00:00
Gina Peter Banyard
c70219e4aa
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  jit: fixed JIT "Attempt to assign property of non-object" warning emitted at the same time as Error is being thrown
2023-11-27 16:20:44 +00:00
Gina Peter Banyard
126a255d66
jit: fixed JIT "Attempt to assign property of non-object" warning emitted at the same time as Error is being thrown 2023-11-27 16:19:35 +00:00
Gina Peter Banyard
52463ae233
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  jit: fixed "Uninitialized string offset" warning being emitted at the same time as invalid offset Error
2023-11-27 16:06:15 +00:00
Gina Peter Banyard
ed8b901869
jit: fixed "Uninitialized string offset" warning being emitted at the same time as invalid offset Error 2023-11-27 16:04:41 +00:00
Niels Dossche
3269aa95cb Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12791: Possible dereference of NULL in MySQLnd debug code
2023-11-27 14:02:19 +01:00
Niels Dossche
6a914cb7a5 Fix GH-12791: Possible dereference of NULL in MySQLnd debug code
Closes GH-12794.
2023-11-27 14:01:46 +01:00
Niels Dossche
f8bfc0e373 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Avoid using uninitialised struct
2023-11-25 20:08:26 +01:00
Niels Dossche
ebb4488def Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Avoid using uninitialised struct
2023-11-25 20:08:01 +01:00
Mikhail Galanin
7e7817bc2f Avoid using uninitialised struct
Closes GH-12046.
2023-11-25 20:07:14 +01:00
Bob Weinand
88537c55b5 Merge branch 'PHP-8.2' into PHP-8.3 2023-11-25 01:01:56 +01:00
Bob Weinand
50ccea31f2 Merge branch 'PHP-8.1' into PHP-8.2 2023-11-25 00:59:26 +01:00
Bob Weinand
1305ea23ce Add NEWS entry for GH-12768 2023-11-25 00:57:22 +01:00
Derick Rethans
73246bac00 Update NEWS 2023-11-23 16:18:34 +00:00
Ilija Tovilo
daa38dd63e
Fix in-place modification of filename in php_message_handler_for_zend
php_strip_url_passwd modifies url in-place. We cannot assume from
php_message_handler_for_zend that data is a temporary, modifiable string.

Fixes oss-fuzz #64209
Closes GH-12733
2023-11-22 21:09:42 -06:00
Ilija Tovilo
1fdcfa4ebe
Fix use-after-free of name in var-var with malicious error handler
Fixes oss-fuzz #54325
Closes GH-12732
2023-11-22 21:08:55 -06:00
Jakub Zelenka
55e0748487
Fix #50713: openssl_pkcs7_verify() may ignore untrusted CAs
Closes GH-12499
2023-11-22 21:03:55 -06:00
Niels Dossche
243fa9c143
Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
The namespace data is freed and set to NULL, but there remain references
to the namespace declaration nodes. This (rightfully) confuses libxml2
because its invariants are broken. We also have to remove all remaining
references from the subtree. This fixes the data corruption bug.

Closes GH-12681.
2023-11-22 20:39:30 -06:00
Niels Dossche
6a76e5d0a2
Fix GH-12702: libxml2 2.12.0 issue building from src
Fixes GH-12702.

Co-authored-by: nono303 <github@nono303.net>
2023-11-22 20:39:30 -06:00
Jakub Zelenka
a7a6151c4f
Fix bug #79945: Stream wrappers in imagecreatefrompng causes segfault
Closes GH-12696
2023-11-22 20:39:30 -06:00
Niels Dossche
df2af7ff65
Fix GH-12675: MEMORY_LEAK in phpdbg_prompt.c
Have to use file_put_contents() instead of --FILE-- because we have to
actually load it using the exec command, *and* have to make multiple
files, and note that we can only load files relative from the current
directory, so we can't rely on files being in the sapi/phpdbg/tests
folder.

Closes GH-12680.
2023-11-22 20:39:29 -06:00
Niels Dossche
c376f9943f
Fix GH-12655: proc_open() does not take into account references in the descriptor array
Closes GH-12658.
2023-11-22 20:39:28 -06:00
Niels Dossche
e1c6a7c4de
Fix GH-12621: browscap segmentation fault when configured in the vhost
The temporary HashTable has a destructor that releases the string held
by the entry's value. However, browscap_intern_str(_ci) only incremented
the refcount for the reference created by the return value. As the
HashTable is only used during parsing, we don't need to manage the
reference count of the value anyway, so get rid of the destructor.

This is triggerable in two cases:
 - When using php_admin_value to set the ini at the activation stage
 - When running out of space for the opcache-interned strings

Closes GH-12634.
2023-11-22 20:39:28 -06:00
Niels Dossche
6641cd159e
Fix GH-12635: Test bug69398.phpt fails with ICU 74.1
ICU 74.1 contains new locale data that breaks the test.
Split the test based on the version number to resolve the issue.

Closes GH-12653.
2023-11-22 20:39:27 -06:00
Gina Peter Banyard
af155cf2dc
Mention correct bug number
I'm tired
2023-11-22 04:14:37 +00:00
Gina Peter Banyard
37f67a9a98
ext/standard: Fix GH-9316
http_build_query() default null argument for  is implicitly coerced to string

Closes GH-9316
2023-11-22 04:09:40 +00:00
Jakub Zelenka
178d3acf4c
PHP 8.3 is now 8.3.1-dev 2023-11-21 14:54:52 +00:00
Jakub Zelenka
f35a22adba
Prepare NEWS for 8.3.0 2023-11-21 14:00:51 +00:00
Jakub Zelenka
1e66e6ae73
Revert incomplete PG pipeline addition
Closes GH-12735
2023-11-20 16:22:29 +00:00
Peter Kokot
ff2b50889c
Refactor checks for fpathconf and pathconf
These two might not be available everywhere so we check them in
config.m4 when doing the configure step. Check is skipped for musl libc
due to limited implementation.

Constants that are defined into main/php_config.h:
HAVE_FPATHCONF
HAVE_PATHCONF

Implemented via GH-10238
Related to GH-10350
Fixes GH-12725
2023-11-20 13:39:21 +00:00
Ilija Tovilo
05a815399e
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix in-place modification of filename in php_message_handler_for_zend
2023-11-20 14:13:06 +01:00
Ilija Tovilo
d8e866da04
Fix in-place modification of filename in php_message_handler_for_zend
php_strip_url_passwd modifies url in-place. We cannot assume from
php_message_handler_for_zend that data is a temporary, modifiable string.

Fixes oss-fuzz #64209
Closes GH-12733
2023-11-20 14:12:25 +01:00
Ilija Tovilo
88d012f360
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix use-after-free of name in var-var with malicious error handler
2023-11-20 14:06:25 +01:00
Ilija Tovilo
ea52706a2a
Fix use-after-free of name in var-var with malicious error handler
Fixes oss-fuzz #54325
Closes GH-12732
2023-11-20 14:05:46 +01:00
Niels Dossche
6176538d99 Fix GH-11992: utf_encodings.phpt fails on Windows 32-bit
Similar bug as before in #10776, but now in other code.

Closes GH-12726.
2023-11-19 16:45:53 +01:00
Niels Dossche
0a3b891ba1 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12721: SplFileInfo::getFilename() segfault in combination with GlobIterator and no directory separator
2023-11-19 11:52:58 +01:00
Niels Dossche
4d41dffb4f Fix GH-12721: SplFileInfo::getFilename() segfault in combination with GlobIterator and no directory separator
This broke in 7cd8879 and 9bae9ab. NULL is a perfectly valid return
value that should be handled.

Closes GH-12722.
2023-11-19 11:52:27 +01:00
Jakub Zelenka
b3947744c7
Merge branch 'PHP-8.2' into PHP-8.3 2023-11-17 19:43:34 +00:00
Jakub Zelenka
f90b40416f
Fix #50713: openssl_pkcs7_verify() may ignore untrusted CAs
Closes GH-12499
2023-11-17 19:42:28 +00:00
Niels Dossche
2b42b73c0b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
  Fix GH-12702: libxml2 2.12.0 issue building from src
2023-11-17 19:58:31 +01:00
Niels Dossche
3167d07603 Fix GH-12616: DOM: Removing XMLNS namespace node results in invalid default: prefix
The namespace data is freed and set to NULL, but there remain references
to the namespace declaration nodes. This (rightfully) confuses libxml2
because its invariants are broken. We also have to remove all remaining
references from the subtree. This fixes the data corruption bug.

Closes GH-12681.
2023-11-17 19:47:08 +01:00
Niels Dossche
8a95e616b9 Fix GH-12702: libxml2 2.12.0 issue building from src
Fixes GH-12702.

Co-authored-by: nono303 <github@nono303.net>
2023-11-17 19:46:30 +01:00
Jakub Zelenka
7abe3fe4c6
Merge branch 'PHP-8.2' into PHP-8.3 2023-11-17 13:41:50 +00:00
Jakub Zelenka
6734880ef5
Fix bug #79945: Stream wrappers in imagecreatefrompng causes segfault
Closes GH-12696
2023-11-17 13:26:42 +00:00
Niels Dossche
c83632a503 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Use __DIR__-relative path in tests
  Fix GH-12675: MEMORY_LEAK in phpdbg_prompt.c
2023-11-15 22:00:44 +01:00
Niels Dossche
4f1103ef3b Fix GH-12675: MEMORY_LEAK in phpdbg_prompt.c
Have to use file_put_contents() instead of --FILE-- because we have to
actually load it using the exec command, *and* have to make multiple
files, and note that we can only load files relative from the current
directory, so we can't rely on files being in the sapi/phpdbg/tests
folder.

Closes GH-12680.
2023-11-15 21:59:55 +01:00
Remi Collet
6d26d4c446
NEWS 2023-11-14 14:58:52 +01:00
Remi Collet
2536cf78b8
NEWS 2023-11-14 14:56:59 +01:00
Remi Collet
0b5824e17c
NEWS 2023-11-14 14:56:06 +01:00
Niels Dossche
5c25742c26 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12655: proc_open() does not take into account references in the descriptor array
2023-11-13 19:34:40 +01:00
Niels Dossche
86c7d3ed1f Fix GH-12655: proc_open() does not take into account references in the descriptor array
Closes GH-12658.
2023-11-13 19:29:44 +01:00
Niels Dossche
1fb73463d3 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12621: browscap segmentation fault when configured in the vhost
2023-11-11 18:36:32 +01:00
Niels Dossche
7353c7ce17 Fix GH-12621: browscap segmentation fault when configured in the vhost
The temporary HashTable has a destructor that releases the string held
by the entry's value. However, browscap_intern_str(_ci) only incremented
the refcount for the reference created by the return value. As the
HashTable is only used during parsing, we don't need to manage the
reference count of the value anyway, so get rid of the destructor.

This is triggerable in two cases:
 - When using php_admin_value to set the ini at the activation stage
 - When running out of space for the opcache-interned strings

Closes GH-12634.
2023-11-11 18:35:57 +01:00
Niels Dossche
608842b5b7 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12635: Test bug69398.phpt fails with ICU 74.1
2023-11-11 17:04:37 +01:00
Niels Dossche
333cf3c111 Fix GH-12635: Test bug69398.phpt fails with ICU 74.1
ICU 74.1 contains new locale data that breaks the test.
Split the test based on the version number to resolve the issue.

Closes GH-12653.
2023-11-11 17:04:01 +01:00
Dmitriy Degtyaryov
63898008c0 Fix GH-9344: pgsql pipeline mode proposal.
Adding pg_send_flush_request.
Fix freeze after next execute pg_send_* on PQgetResult in _php_pgsql_link_has_results.
Set nonblocking for pipelining mode.
No flush client buffer in pg_send_* for pipelining mode.

Close GH-12644
2023-11-10 16:06:04 +00:00
Niels Dossche
e6fef2944b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12633: sqlite3_defensive.phpt fails with sqlite 3.44.0
  Fix GH-12628: The gh11374 test fails on Alpinelinux
2023-11-10 00:12:47 +01:00
Niels Dossche
fbda6b50a3 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12633: sqlite3_defensive.phpt fails with sqlite 3.44.0
  Fix GH-12628: The gh11374 test fails on Alpinelinux
2023-11-10 00:08:09 +01:00
SakiTakamachi
2a4775d6a7 Fix GH-12633: sqlite3_defensive.phpt fails with sqlite 3.44.0
Removes 'PRAGMA writable_schema;'.

From sqlite changelog https://www.sqlite.org/releaselog/3_44_0.html:
> The SQLITE_DBCONFIG_DEFENSIVE setting now prevents PRAGMA writable_schema
> from being turned on.
> Previously writable_schema could be turned on, but would not actually allow
> the schema to be writable. Now it simply cannot be turned on.

Closes GH-12636.
2023-11-10 00:03:33 +01:00
Niels Dossche
78fba9cb80 Fix GH-12628: The gh11374 test fails on Alpinelinux
Closes GH-12636.
2023-11-10 00:01:22 +01:00
Jakub Zelenka
42ea0ca3db
Merge branch 'PHP-8.2' into PHP-8.3 2023-11-09 13:38:55 +00:00
Jakub Zelenka
c6eeb83e1f
Merge branch 'PHP-8.1' into PHP-8.2 2023-11-09 13:32:33 +00:00
Daniil Gentili
10b2b4a52c
Fix memory leak in standard syslog device handling
The BG(syslog_device) is leaked in RINIT.

Closes GH-12501
2023-11-09 13:29:09 +00:00
Ben Ramsey
55dfc29539
PHP-8.1 is now for PHP 8.1.27-dev 2023-11-07 14:28:31 -06:00
Eric Mann
27cd9d2844
Update news for PHP 8.3.0 GA 2023-11-07 12:13:42 -08:00
Jakub Zelenka
2aae3f8a24
Fix NEWS for 8.3.0RC5 2023-11-07 19:32:08 +00:00
Sergey Panteleev
239a26fa90
PHP-8.2 is now for PHP 8.2.14-dev 2023-11-07 17:12:19 +03:00
Ilija Tovilo
cb1e842929
Fix inference of COPY_TMP
Since GH-11592 COPY_TMP may receive and thus define references. Unfortunately,
the name COPY_TMP is no longer accurate.

Closes GH-12619
2023-11-07 12:02:45 +01:00
Jakub Zelenka
52b13f6ddb
Merge branch 'PHP-8.2' into PHP-8.3 2023-11-03 17:17:52 +00:00
Jakub Zelenka
882cc4f804
Merge branch 'PHP-8.1' into PHP-8.2 2023-11-03 17:17:23 +00:00
Jakub Zelenka
a8c6c6165b
Fix GH-9921: Loading ext in FPM config does not register module handlers
Closes GH-12377
2023-11-03 16:53:09 +00:00
Jakub Zelenka
e43438544e
Merge branch 'PHP-8.2' into PHP-8.3 2023-11-03 14:07:36 +00:00
Jakub Zelenka
e3d1beb0f1
Fix bug #76922: FastCGI terminates conn after FCGI_GET_VALUES
Closes GH-12387
2023-11-03 14:06:36 +00:00
Niels Dossche
ea299d44a1 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix validation logic of php:function() callbacks in dom and xsl
2023-11-02 20:32:36 +01:00
Niels Dossche
304e482813 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix validation logic of php:function() callbacks in dom and xsl
2023-11-02 20:32:10 +01:00
Niels Dossche
20c9c4a367 Fix validation logic of php:function() callbacks in dom and xsl
Two issues:
- Assumed that at least 1 argument (function name) was provided.
- Incorrect error path for the non-callable case.

Closes GH-12593.
2023-11-02 20:28:55 +01:00
Ilija Tovilo
ddabe89add
Fix OP1 leak in error path of post inc/dec
Fixes oss-fuzz #63802
Closes GH-12599
2023-11-02 19:30:59 +01:00
Dmitry Stogov
22735b3ff5 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT
  ext/intl: change when the locale is invalid for the 8.1/8.2 serie.
2023-11-02 08:15:50 +03:00
David Carlier
a39e869b55 Merge branch 'PHP-8.1' into PHP-8.2 2023-11-01 19:13:08 +00:00
David Carlier
0da1356c66 ext/intl: change when the locale is invalid for the 8.1/8.2 serie.
does not throws an exception as it's considered as a too string change,
but the code user still needs to double check.
2023-11-01 19:12:50 +00:00
Máté Kocsis
98e8e277b5
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12558 Escape \N in generated stubs
2023-10-31 10:09:22 +01:00
Máté Kocsis
d4e40dc0e1
Fix GH-12558 Escape \N in generated stubs (#12562) 2023-10-31 10:06:56 +01:00
Arnaud Le Blanc
e9d5f918b1 [ci skip] NEWS 2023-10-29 12:25:42 +01:00
Arnaud Le Blanc
c7fda3b46f [ci skip] NEWS 2023-10-29 12:20:31 +01:00
Arnaud Le Blanc
29dbc4ae83 [ci skip] NEWS 2023-10-29 12:19:56 +01:00
Niels Dossche
f9a24969d0 Fix #47531: No way of removing redundant xmlns: declarations
Now it's possible via removeAttribute("xmlns:prefix").
It was not possible to reuse a libxml2 function to reconcile because it
does not align with DOM behaviour.

Closes GH-12542.
2023-10-28 15:46:22 +02:00
Arnaud Le Blanc
79e1830ddd [ci skip] NEWS 2023-10-28 15:06:15 +02:00
Arnaud Le Blanc
ae9118a7e4 [ci skip] NEWS 2023-10-28 15:04:13 +02:00
Arnaud Le Blanc
bbfadd32e8 [ci skip] NEWS 2023-10-28 15:02:20 +02:00
Niels Dossche
e7cbcfda14 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-11374: Different preg_match result with -d pcre.jit=0
2023-10-27 17:45:44 +02:00
Niels Dossche
1ea8a10ca8 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11374: Different preg_match result with -d pcre.jit=0
2023-10-27 17:44:56 +02:00
Michael Voříšek
83a505e85f Fix GH-11374: Different preg_match result with -d pcre.jit=0
This is a backport of https://github.com/PCRE2Project/pcre2/pull/300.

Closes GH-12439.
2023-10-27 17:43:33 +02:00
Ayesh Karunaratne
f8433a5100 Minor fix in NEWS alignment
Fixes a minor misalignment in `NEWS` file, following the other list items
in the rest of the file.
2023-10-26 19:59:30 +02:00
Niels Dossche
c6d312080c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix bug #75306: Memleak in SoapClient
2023-10-26 19:59:21 +02:00
Niels Dossche
e39538bed0 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix bug #75306: Memleak in SoapClient
2023-10-26 19:59:00 +02:00
Niels Dossche
27797a26ca Fix bug #75306: Memleak in SoapClient
Setting the stream context via php_stream_context_to_zval() will
increase the reference count. So if the new context is created, then it
will end up with a reference count of 2 while it should be 1.

Credits to cmb for the analysis. I arrived at the same patch as he did.

Closes GH-12523.
2023-10-26 19:58:31 +02:00
Niels Dossche
6953dd658c Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix incorrect dtor for persistent sdl->encoders
2023-10-25 17:56:41 +02:00
Niels Dossche
07de4b69d4 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect dtor for persistent sdl->encoders
2023-10-25 17:54:46 +02:00
Niels Dossche
9f7f3b2034 Fix incorrect dtor for persistent sdl->encoders
Closes GH-12515.
2023-10-25 17:53:42 +02:00
Niels Dossche
a64b48ba92 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix null pointer dereferences in case of allocation failure
2023-10-24 19:42:43 +02:00
Niels Dossche
dd8a945eb7 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [ci skip] NEWS
  Fix null pointer dereferences in case of allocation failure
2023-10-24 19:36:57 +02:00
Niels Dossche
98908db72b [ci skip] NEWS 2023-10-24 19:35:55 +02:00
icy17
900f0cab9f Fix null pointer dereferences in case of allocation failure
Closes GH-12506.
2023-10-24 19:34:47 +02:00
Jakub Zelenka
82e9ba2bb3
Merge branch 'PHP-8.2' into PHP-8.3 2023-10-22 13:27:45 +01:00
Jakub Zelenka
275d36ea2f
Merge branch 'PHP-8.1' into PHP-8.2 2023-10-22 13:27:19 +01:00
Jakub Zelenka
52aa0d9ecc
Fix bug #75708: getimagesize with "&$imageinfo" fails on StreamWrappers
Closes GH-12444
2023-10-22 13:26:18 +01:00
Jakub Zelenka
ac07b6e7ac
Merge branch 'PHP-8.2' into PHP-8.3 2023-10-22 13:23:10 +01:00
Jakub Zelenka
b2f6b6ea9c
Merge branch 'PHP-8.1' into PHP-8.2 2023-10-22 13:21:56 +01:00
Jakub Zelenka
83a242ec0c
Fix GH-12489: Missing sigbio creation checking in openssl_cms_verify
Closes GH-12490
2023-10-22 13:20:43 +01:00
Niels Dossche
7da6c0f1db Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix segfault and assertion failure with refcounted props and arrays
  Fix incorrect uri check in SOAP caching
  Fix bug #66150: SOAP WSDL cache race condition causes Segmentation Fault
2023-10-19 18:32:47 +02:00
Niels Dossche
1b16646270 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix segfault and assertion failure with refcounted props and arrays
  Fix incorrect uri check in SOAP caching
  Fix bug #66150: SOAP WSDL cache race condition causes Segmentation Fault
2023-10-19 18:32:01 +02:00
Niels Dossche
01d61605d3 Fix segfault and assertion failure with refcounted props and arrays
Closes GH-12478.
2023-10-19 18:31:48 +02:00
Niels Dossche
abf562c417 Fix incorrect uri check in SOAP caching
If i == 0 then the check will compare 0 bytes.
We are supposed to check if the uri is identical.

Closes GH-12479.
2023-10-19 18:29:11 +02:00
Niels Dossche
43e63168e9 Fix bug #66150: SOAP WSDL cache race condition causes Segmentation Fault
When we have two processes both trying to cache a WSDL, they might start
writing the data to the same temporary file, causing file corruption due
to the race condition. Fix this by creating a temporary file first, and
then moving it to the final location. If moving fails then we know
another process finished caching first.

This also fixes #67617 as a consequence of its implementation.

Closes GH-12469.
2023-10-19 18:27:38 +02:00
Ilija Tovilo
8347740c8c
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix double-free of doc_comment when overriding static property via trait
2023-10-19 15:23:26 +02:00
Ilija Tovilo
4f1f77c51b
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix double-free of doc_comment when overriding static property via trait
2023-10-19 15:23:00 +02:00
Ilija Tovilo
af3d2f7ec9
Fix double-free of doc_comment when overriding static property via trait
When redeclaring an overridden static property with a trait we're removing the
property from the class. However, because the property itself does not belong to
the class we must not free its associated data.

This issue is exposed by 9a250cc9d6 in PHP 8.3+ because duplicate static
properties in traits are no longer skipped, but redeclared.

Fixes GH-12468
2023-10-19 15:21:53 +02:00
Ilija Tovilo
0de79a8f5a
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed a bug in zend_memnistr with single character needle
2023-10-18 16:02:19 +02:00
SakiTakamachi
736032febf
Fixed a bug in zend_memnistr with single character needle
Fixes GH-12457
Closes GH-12458
2023-10-18 16:00:49 +02:00
Niels Dossche
35d93d29b8 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Add missing module dependency for xsl
2023-10-15 21:55:12 +02:00
Niels Dossche
428ecf48ef Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Add missing module dependency for xsl
2023-10-15 21:53:37 +02:00
Niels Dossche
68aa793173 Add missing module dependency for xsl
This module cannot work without the DOM extension.

Closes GH-12441.
2023-10-15 21:52:47 +02:00
Niels Dossche
0cab865275 Fix compile error when php_libxml.h is included in C++
See https://github.com/php/pecl-xml-xmldiff/issues/1
2023-10-15 11:48:14 +02:00
Jakub Zelenka
2913447653
Merge branch 'PHP-8.2' into PHP-8.3 2023-10-14 18:44:26 +01:00
Jakub Zelenka
c776f79578
Merge branch 'PHP-8.1' into PHP-8.2 2023-10-14 18:41:48 +01:00
Jakub Zelenka
0217be4d5b
Fix GH-12232: FPM: segfault dynamically loading extension without opcache
Also fixes incorrect assertion in ini init that php_dl is always
temporary.

Closes GH-12277
2023-10-14 18:38:21 +01:00
Niels Dossche
f5d1a194d9 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix registerNodeClass with abstract class crashing
2023-10-13 19:10:51 +02:00
Niels Dossche
a025e6c780 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix registerNodeClass with abstract class crashing
2023-10-13 19:08:13 +02:00
Niels Dossche
d7de0ceca6 Fix registerNodeClass with abstract class crashing
This always results in a segfault when trying to instantiate, so this never
worked. At least throw an error instead of segfaulting to prevent developers
from being confused.

Closes GH-12420.
2023-10-13 19:06:09 +02:00
Tim Düsterhus
582b724c35
random: Fix γ-section implementation for Randomizer::getFloat() (#12402)
The reference implementation of the "Drawing Random Floating-Point Numbers from
an Interval" paper contains two mistakes that will result in erroneous values
being returned under certain circumstances:

- For large values of `g` the multiplication of `k * g` might overflow to
  infinity.
- The value of `ceilint()` might exceed 2^53, possibly leading to a rounding
  error when promoting `k` to double within the multiplication of `k * g`.

This commit updates the implementation based on Prof. Goualard suggestions
after reaching out to him. It will correctly handle inputs larger than 2^-1020
in absolute values. This limitation will be documented and those inputs
possibly be rejected in a follow-up commit depending on performance concerns.
2023-10-13 17:55:14 +02:00
Niels Dossche
124c812542 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12392: Segmentation fault on SoapClient::__getTypes
  Fix GH-11121: ReflectionFiber segfault
  [ci skip] NEWS
2023-10-11 17:27:54 +02:00
Niels Dossche
d8cd0f4ba0 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12392: Segmentation fault on SoapClient::__getTypes
  Fix GH-11121: ReflectionFiber segfault
  [ci skip] NEWS
2023-10-11 17:23:17 +02:00
Niels Dossche
7e4a3236d9 Fix GH-12392: Segmentation fault on SoapClient::__getTypes
There are two issues:
- UAF because the hashmap resized while being iterated over, yet the local
  variables used internally in the macros are not updated.
- The hashmap being iterated over is modified: entries are deleted after
  other entries have been added. This causes the deletion to fail sometimes
  because indices of buckets have shifted.

Fix it by using a while loop iteration and HashPosition position tracker
instead.
Issue exists on PHP 8.1 too, but is much harder to trigger.
The test file reproduces the issue reliably on PHP 8.2 and up.

Closes GH-12409.
2023-10-11 17:21:54 +02:00
Daniil Gentili
71f14510f6 Fix GH-11121: ReflectionFiber segfault
Closes GH-12391.

Co-authored-by: Aaron Piotrowski <aaron@trowski.com>
2023-10-11 17:19:01 +02:00
Niels Dossche
1f4159e504 [ci skip] NEWS
Entry for 90f2e7607a.
2023-10-11 17:17:11 +02:00
Ilija Tovilo
477aadedc7
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Report warning if JIT cannot be enabled
2023-10-11 12:12:30 +02:00
Ilija Tovilo
18942459a2
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Report warning if JIT cannot be enabled
2023-10-11 12:11:59 +02:00
Daniil Gentili
7177461141
Report warning if JIT cannot be enabled
Closes GH-12404
2023-10-11 12:10:48 +02:00
Ilija Tovilo
2e6d34c72e
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix use-after-free of constant name
2023-10-11 11:52:11 +02:00
Ilija Tovilo
53dbb760da
Fix use-after-free of constant name
The constant name is usually interend. Without opcache, compilation always
interns strings. Without opcache, compilation does not intern (new) strings, but
persisting of script does. If a script is not stored in shm the constant name
will not be interned.

The building of enum backing stores was missing a addref for the constant name,
leading to a double-free when releasing constants and backing stores of enums.

Fixes GH-12366
Closes GH-12405
2023-10-11 11:49:40 +02:00
Patrick Allaert
be64db5939
PHP-8.1 is now for PHP 8.1.26-dev 2023-10-10 22:54:03 +02:00
Pierrick Charron
2642a08697
PHP-8.2 is now for PHP 8.2.13-dev 2023-10-10 11:45:26 -04:00
Eric Mann
cd71ab33c4
Prepare NEWS for PHP 8.3.0RC5 2023-10-10 07:54:41 -07:00
Niels Dossche
58a1103bee Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-8996: DOMNode serialization on PHP ^8.1
  Fix GH-12380: JIT+private array property access inside closure accesses private property in child class
2023-10-09 22:12:05 +02:00
Niels Dossche
5e1058b426 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-8996: DOMNode serialization on PHP ^8.1
  Fix GH-12380: JIT+private array property access inside closure accesses private property in child class
2023-10-09 22:10:54 +02:00
Niels Dossche
24e5e4ec0d Fix GH-8996: DOMNode serialization on PHP ^8.1
PHP 8.1 introduced a seemingly unintentional BC break in ca94d55a19 by
blocking the (un)serialization of DOM objects.
This was done because the serialization never really worked and just
resulted in an empty object, which upon unserialization just resulted in
an object that you can't use.

Users can however implement their own serialization methods, but the
commit made that impossible as the ACC flag gets passed down to the
child class. An approach was tried in #10307 with a new ACC flag to
selectively allow serialization with subclasses if they implement the
right methods. However, that was found to be too ad hoc.

Instead, let's abuse how the __sleep and __wakeup methods work to throw
the exception instead. If the child class implements the __serialize /
__unserialize method, then the throwing methods won't be called.
Similarly, if the child class implements __sleep and __wakeup, then
they're overridden and it doesn't matter that they throw.

For the user, this PR has the exact same behaviour for (sub)classes that
don't implement the serialization methods: an exception will be thrown.
For code that previously implemented subclasses with these methods, this
approach will make that code work again. This approach should be both BC
preserving and unbreak user's code.

Closes GH-12388.

For the test:
Co-authored-by: wazelin <contact@sergeimikhailov.com>
2023-10-09 22:10:05 +02:00
Niels Dossche
fb6838770c Fix GH-12380: JIT+private array property access inside closure accesses private property in child class
For private fields, the scope has to be taken into account, otherwise
the property info may come from the wrong ce.

Closes GH-12381.
2023-10-09 22:10:05 +02:00
Niels Dossche
7c41509e26 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  php_cli_server: ensure single date header is present
2023-10-06 17:51:38 +02:00
Niels Dossche
a1845944ce Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  php_cli_server: ensure single date header is present
2023-10-06 17:50:13 +02:00
coppolafab
f6ac08c6a3 php_cli_server: ensure single date header is present
Currently the PHP Development Server appends a Date header in the
response, despite already set from user code.

Added a check condition before append the header, and a test file.

Closes GH-12363.
2023-10-06 17:49:30 +02:00
Ilija Tovilo
520fc70245
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Invalidate path even if the file was deleted
2023-10-03 15:32:53 +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
Ilija Tovilo
4ba5699903
Fix invalid returned opcode for memoized expressions
Closes GH-12345
2023-10-03 14:01:43 +02:00
Niels Dossche
0427e26729 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix #80092: ZTS + preload = segfault on shutdown
2023-10-02 19:42:10 +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
Ilija Tovilo
b31a5b2731
Fix str_decrement() on "1"
Closes GH-12339
2023-10-02 16:42:04 +02:00
Niels Dossche
eebc528cbf Fix broken cache invalidation with deallocated and reallocated document node
The original caching implementation had an oversight in combination with
the new lifetime management in DOM for 8.3.
The modification counter is stored on the document object itself, but as
that can get deallocated when all references disappear, stale cache data
can be used. Normally this isn't a problem, unless getElementsByTagName is
called not on the document but on a child node. Fix it by moving caching
data into the ref object, which will outlive all nodes from a document
even if the document object disappears.

Closes GH-12338.
2023-10-01 17:06:02 +02:00
Anatol Belski
31a44c8ca7 NEWS: Add note about #11891
[ci skip]

Signed-off-by: Anatol Belski <ab@php.net>
2023-09-30 19:19:44 +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
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
ec2ef6465d Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Apply SimpleXML iterator fixes only on master
2023-09-30 17:55:34 +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
Niels Dossche
04a2a42f2a Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Revert "Fix GH-10008: Narrowing occurred during type inference of ZEND_ADD_ARRAY_ELEMENT"
2023-09-30 01:27:29 +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
df89409aba Fix compile error with -Werror=incompatible-function-pointer-types and old libxml2
libxml2 prior to 2.9.8 had a different signature for xmlHashScanner.
This signature changed in e03f0a199a
Use an #if to work around the incompatible signature.

Closes GH-12326.
2023-09-30 00:12:20 +02:00
Niels Dossche
fa2d556fcd Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  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:11:31 +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
Jakub Zelenka
517411d2fb Prepare NEWS for PHP 8.3.0RC4 2023-09-29 11:38:28 +01:00
twosee
b5da98b972
Fix socket_export_stream() with wrong protocol
Closes GH-12310.
2023-09-29 18:33:12 +08:00
Niels Dossche
6a2b885155 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Restore old namespace reconciliation behaviour
2023-09-27 22:40:37 +02: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
3631381af4 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  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:45:02 +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
190a535325 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12167 and GH-12169: Unable to get comment or processing instruction contents in SimpleXML
2023-09-25 19:49:36 +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
4400eb270f Merge branch 'PHP-8.2' into PHP-8.3 2023-09-24 15:20:24 +01: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
Thomas Hurst
66a33dbdce 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:08:08 +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
d9e72bcdab Merge branch 'PHP-8.2' into PHP-8.3 2023-09-23 20:12:56 +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
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
2bbe4fda75 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix memory leak when calling xml_parse_into_struct() twice
  Fix return type of stub of xml_parse_into_struct()
2023-09-21 19:52:21 +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
David Carlier
35a502f168 Merge branch 'PHP-8.2' into PHP-8.3 2023-09-21 05:35:48 +01:00
David Carlier
63150dc2b1 Merge branch 'PHP-8.1' into PHP-8.2 2023-09-21 05:35:04 +01:00
David Carlier
84c4336aa3 Fix GH-12243, segfault on IntlDateFormatter::construct with dateType set to UDAT_PATTERN but not timeType.
udat_open expects its timeStyle's argument to be set to UDAT_PATTERN
 when dateStyle is, regardless if there an actual pattern or not.

Close GH-12245
2023-09-21 05:34:49 +01:00
Niels Dossche
b08802d160 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12215: Module entry being overwritten causes type errors in ext/dom (<= PHP 8.3)
  Fix bug #55098: SimpleXML iteration produces infinite loop
2023-09-20 20:59:22 +02:00
Niels Dossche
84fae4a160 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12215: Module entry being overwritten causes type errors in ext/dom (<= PHP 8.3)
  Fix bug #55098: SimpleXML iteration produces infinite loop
2023-09-20 20:58:08 +02:00
Niels Dossche
da6097ffc8 Fix GH-12215: Module entry being overwritten causes type errors in ext/dom (<= PHP 8.3)
When we try to load an extension multiple times, we still overwrite the
type, module number, and handle. If the module number is used to
indicate module boundaries (e.g. in reflection and in dom, see e.g.
dom_objects_set_class_ex), then all sorts of error can happen.

In the case of ext/dom, OP's error happens because the following
happens:
- The property handler is set up incorrectly in
  dom_objects_set_class_ex() because the wrong module number is
  specified. The class highest in the hierarchy is DOMNode, so the
  property handler is incorrectly set to that of DOMNode instead of
  DOMDocument.
- The documentElement property doesn't exist on DOMNode, it only exists
  on DOMDocument, so it tries to read using zend_std_read_property().
  As there is no user property called documentElement, that read
  operation returns an undef value.
  However, the type is still checked, resulting in the strange exception.

Closes GH-12219.
2023-09-20 20:57:04 +02:00
Niels Dossche
1a4e401bf0 Fix bug #55098: SimpleXML iteration produces infinite loop
Closes GH-12247.
2023-09-20 20:54:53 +02:00
Niels Dossche
15bbae7bc9 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-11956: PCRE regular expressions with JIT enabled gives different result
2023-09-18 20:13:45 +02:00
Niels Dossche
d61efdfe97 Fix GH-11956: PCRE regular expressions with JIT enabled gives different result
The code in the attached test used to work correctly in PHP 8.0, but not
in 8.1+. This is because PHP 8.1+ uses a more modern version of pcre2
than PHP 8.0, and that pcre2 versions has a regression.

While upgrading pcre2lib seems to be only done for the master branch, it
is possible to backport upstream fixes to stable branches. This has been
already done in the past in for JIT regressions [1], so it is not
unprecedented.

We backport the upstream pcre2 fix [2].

[1] https://github.com/php/php-src/commit/788a701e222
[2] https://github.com/PCRE2Project/pcre2/pull/135

Closes GH-12108.
2023-09-18 20:11:56 +02:00
David Carlier
639bcb4078 Merge branch 'PHP-8.2' into PHP-8.3 2023-09-18 17:46:28 +01:00
David Carlier
c39d4481c5 Merge branch 'PHP-8.1' into PHP-8.2 2023-09-18 17:46:11 +01:00
Florian Sowade
910f579f14 Fix GH-12207 memory leak of doc blocks of static properties
When declaring the same static property with a doc block in a class and in a trait,
the doc block of the property in the class is leaked. While at it, possibly fix doc
 comment for internal classes.

Close GH-12238
2023-09-18 17:44:47 +01:00
George Peter Banyard
0b614a6c2b
Fixed oss-fuzz #62294: Unsetting variable after ++/-- on string variable warning
Closes GH-12202
2023-09-17 15:49:46 +01:00
Niels Dossche
673babed24 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12208: SimpleXML infinite loop when a cast is used inside a foreach
2023-09-17 16:35:11 +02:00
Niels Dossche
f4f34b6e5a Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12208: SimpleXML infinite loop when a cast is used inside a foreach
2023-09-17 16:34:38 +02:00
Niels Dossche
486276f0f9 Fix GH-12208: SimpleXML infinite loop when a cast is used inside a foreach
Closes GH-12229.
2023-09-17 16:33:32 +02:00
Niels Dossche
4bb27e2d9b Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12223: Entity reference produces infinite loop in var_dump/print_r
  Fix GH-12192: SimpleXML infinite loop when getName() is called within foreach
  Fix GH-12186: segfault copying/cloning a finalized HashContext
2023-09-16 21:28:24 +02:00
Niels Dossche
5df473d2c7 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12223: Entity reference produces infinite loop in var_dump/print_r
  Fix GH-12192: SimpleXML infinite loop when getName() is called within foreach
  Fix GH-12186: segfault copying/cloning a finalized HashContext
2023-09-16 21:24:20 +02:00
Niels Dossche
39a9e561f9 Fix GH-12223: Entity reference produces infinite loop in var_dump/print_r
Closes GH-12223.
2023-09-16 21:19:58 +02:00
Niels Dossche
4d888cf53f Fix GH-12192: SimpleXML infinite loop when getName() is called within foreach
This happens because getName() resets the iterator to the start because
it overwrites the iterator data.
We add a version of get_first_node that does not overwrite the iterator
data.

Closes GH-12193.
2023-09-16 21:19:28 +02:00
Max Semenik
10f5a06d3c Fix GH-12186: segfault copying/cloning a finalized HashContext
Closes GH-12186.
Closes GH-12187.
2023-09-16 21:18:27 +02:00
Tim Düsterhus
d344fe06a2
Fix #[Override] on traits overriding a parent method without a matching interface (#12205)
Fixes GH-12189

Co-authored-by: Ilija Tovilo <ilija.tovilo@me.com>
2023-09-15 14:57:10 +02:00
Niels Dossche
60b1673b20 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-12170: Can't use xpath with comments in SimpleXML
2023-09-14 18:44:39 +02:00
Niels Dossche
b3bce2328f Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-12170: Can't use xpath with comments in SimpleXML
2023-09-14 18:42:47 +02:00
Niels Dossche
747335f100 Fix GH-12170: Can't use xpath with comments in SimpleXML
Closes GH-12177.
2023-09-14 18:42:16 +02:00
Ilija Tovilo
b15e9b5779
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [skip ci] Fix NEWS entry
2023-09-14 13:17:46 +02:00
Ilija Tovilo
f6a038d16a
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Fix NEWS entry
2023-09-14 13:17:26 +02:00
Ilija Tovilo
d0b76d7bdc
[skip ci] Fix NEWS entry 2023-09-14 13:16:43 +02:00
Ilija Tovilo
b169725757
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix filter_var with callback and explicit REQUIRE_SCALAR
2023-09-14 11:49:44 +02:00
Ilija Tovilo
85ceb91789
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix filter_var with callback and explicit REQUIRE_SCALAR
2023-09-14 11:49:10 +02:00
Ilija Tovilo
c2fb10d2d2
Fix filter_var with callback and explicit REQUIRE_SCALAR
For some reason, FILTER_CALLBACK disables the FILTER_REQUIRE_SCALAR flag that is
normally set by default. While surprising, this is not something we can change.

However, even specifying FILTER_REQUIRE_SCALAR explicitly does not corrently set
this flag. This is because FILTER_CALLBACK zeroes the flags after they have been
populated from the parameters.

We reverse the checks to make explicitly specifying the flag behave as expected.

Closes GH-12203
2023-09-14 11:48:40 +02:00