Commit graph

18765 commits

Author SHA1 Message Date
Niels Dossche
3ab7aa001f Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Workaround ZTS persistent resource crashes (PHP 8.3 and lower)
2024-02-20 21:25:06 +01:00
Niels Dossche
2f605820a4 Workaround ZTS persistent resource crashes (PHP 8.3 and lower)
For master (8.4-dev) I merged GH-13381. But that PR changes public API
of TSRM, so cannot be used on lower branches.

This patch is a safe workaround for the issue, in combination with a
pre-existing fix using `ifdef ZTS + if (module_started)` inside pgsql
and odbc. The idea is to delay unloading modules until the persistent
resources are destroyed. This will keep the destructor code accessible
in memory.

This is not a proper fix on its own, because we still need the
workaround of not accessing globals after module destruction.
The proper fix is in master.

Closes GH-13388.
2024-02-20 21:24:43 +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
Ilija Tovilo
3a5edcca47
Fix create_object checks
Since PHP 8.3, object handlers may be changed by setting
ce->default_object_handlers, rather than in ce->create_object. Some checks need
to be extended to check for the default handlers.

Closes GH-13272
2024-01-30 16:13:51 +01:00
Dmitry Stogov
49f85c24da Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection) (#13265)
2024-01-30 06:40:44 +03:00
Dmitry Stogov
397d4c244d
Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection) (#13265)
* Fix GH-13193: Significant performance degradation in 'foreach' starting from PHP 8.2.13 (caused by garbage collection)

* Don't run zend_gc_remove_root_tmpvars() if GC is not active or GC buffer is empty
2024-01-30 06:38:30 +03:00
Remi Collet
17d79e1ea6
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  NEWS
  Fix GH-13215 GCC 14 build
2024-01-22 10:59:17 +01:00
Remi Collet
7252660941
Fix GH-13215 GCC 14 build 2024-01-22 10:58:04 +01:00
Alex Dowad
1e92d47f41 Do not allow zend.script_encoding to be set to 'pass'
When investigating another bug reported by GitHub user 'tstangner',
I discovered that PHP segfaults when the INI parameter
zend.script_encoding is set to "pass". This bug dates back to
December 2022 (caused by yours truly in 953864661a).

If any PHP users in the wild were actually setting zend.script_encoding
to "pass" (which would be an utterly useless thing to do), I expect that
someone would have filed a bug report by now. The absence of such bug
reports is evidence that nobody is doing this.

Hence, it seems that the best fix is simply to disallow "pass" as a
choice for zend.script_encoding. The internal function
'php_mb_zend_encoding_list_parser' which I am modifying to accomplish
this has no other in-tree callers, aside from the 'exif' extension.
Further, exif only calls the function with a few hard-coded values, and
none of them are the string "pass", so this change will not have any
impact on exif.
2024-01-21 14:51:54 +02: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
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
Dmitry Stogov
b046143529 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix zend_may_throw() for FETCH_DIM_IS and ISSET_ISEMPTY_DIM_OBJ
2024-01-17 00:32:14 +03:00
Dmitry Stogov
b33e3eb8c2 Fix zend_may_throw() for FETCH_DIM_IS and ISSET_ISEMPTY_DIM_OBJ
Recentlty this insructions were updated to emit warning on inability to
convert double index to long. This may lead to exception.

This fixes memory leak on wordpress test suite (nightly workflow)
2024-01-17 00:19:43 +03: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
Ilija Tovilo
ed64949d12
strtok is not comptime()
Fixes GH-13145
Closes GH-13148
2024-01-14 19:12:41 +01:00
Dmitry Stogov
71a1defdfa Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Disable inlining and inter-procedure-analyses for zend_string_equal_val() function that may be overriden for valgrind (#13099)
2024-01-09 20:06:07 +03:00
Dmitry Stogov
6339938c7e
Disable inlining and inter-procedure-analyses for zend_string_equal_val() function that may be overriden for valgrind (#13099)
This is a more safely way to fix GH-9068
2024-01-09 20:05:51 +03:00
Arnaud Le Blanc
26f54eb490 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS
  Fix timer leak (#13027)
2024-01-05 19:45:51 +01:00
Rob Landers
6342f735b9
Fix timer leak (#13027)
ts_resource() and php_request_startup() both eventually call zend_max_execution_timer_init(), which didn't have a guard to prevent recreating timers, thus resulting in leaking timers. This adds a guard to prevent the leak.
2024-01-05 19:36:19 +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
Dmitry Stogov
fd58f61a22 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix assertion
2023-12-25 13:22:39 +03:00
Dmitry Stogov
5350952a37 Fix assertion
Fixes oss-fuzz #65233
2023-12-25 13:22:03 +03: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
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
Dmitry Stogov
555e8f82e8 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed type inference
2023-12-18 12:28:25 +03:00
Dmitry Stogov
731734dacb Fixed type inference
Fixes oss-fuzz #65150
2023-12-18 12:27:35 +03:00
Arnaud Le Blanc
6aa70b577d WS 2023-12-10 13:24:49 +01:00
Arnaud Le Blanc
b1516d95e0 Clarify the stack limit exception message
Make it clearer why the size is not exactly zend.max_allowed_stack_size
2023-12-10 13:20:21 +01:00
Arnaud Le Blanc
dad6912b99 Fix GH-12643: Stack limit tests failing on ppc64le
These tests were setting zend.max_allowed_stack_size to a small value. On ppc64le
this value is too small and the limit may be reached too soon.
2023-12-10 13:20:21 +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
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
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
Dmitry Stogov
8c9b5996be Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed type inference
2023-12-01 17:09:09 +03:00
Dmitry Stogov
1e55c97601 Fixed type inference
Fixes oss-fuzz #64577, #64579, #64589
2023-12-01 17:08:16 +03: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
bedf1083f3 Add missing NULL pointer checks related to the previous call frame 2023-12-01 09:08:47 +01:00
Dmitry Stogov
64851873da Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fixed GH-8251: Narrowing occurred during type inference of ZEND_FETCH_DIM_W
2023-11-28 23:33:45 +03:00
Dmitry Stogov
423a1e586e Fixed GH-8251: Narrowing occurred during type inference of ZEND_FETCH_DIM_W 2023-11-28 22:49:39 +03:00
Dmitry Stogov
f4b473ca71 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Align error messages between normal VM and JIT for RW when using object as array (#12799)
2023-11-28 00:40:48 +03:00
Gina Peter Banyard
e94ab0461c
Align error messages between normal VM and JIT for RW when using object as array (#12799) 2023-11-28 00:37:21 +03:00
Alex Dowad
31d43164e8 Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Return value of mb_get_info can be NULL
2023-11-27 21:13:21 +02:00
Alex Dowad
d8ef868b92 Return value of mb_get_info can be NULL
This has been the case at least since PHP 5.4. Thanks to Girgias for
pointing it out.

It appears that there are several global variables internal to mbstring
which can be queried via mb_get_info() and which could be NULL, but
at the very least, we know that "mbstring.http_input" is one of them.
2023-11-27 20:53:37 +02:00
Bob Weinand
88537c55b5 Merge branch 'PHP-8.2' into PHP-8.3 2023-11-25 01:01:56 +01:00