1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

6749 Commits

Author SHA1 Message Date
Weilin Du
2918caee20 ext/*: Remove break after return (#21485) 2026-03-23 20:30:13 +01:00
Gina Peter Banyard
f40b356ad9 Use smart_str_append() if we have a zend_string* (#21414) 2026-03-21 17:06:14 +00:00
Dmitry Stogov
db37779940 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-21411: opcache_compile_file() fails to early-bind classes without parents (#21412)
2026-03-19 11:13:41 +03:00
Dmitry Stogov
aa9964eebb Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21411: opcache_compile_file() fails to early-bind classes without parents (#21412)
2026-03-19 11:13:30 +03:00
Rasmus Lerdorf
1a79ea47c5 Fix GH-21411: opcache_compile_file() fails to early-bind classes without parents (#21412) 2026-03-19 11:12:45 +03:00
Dmitry Stogov
0b2d8136e3 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update IR (#21462)
2026-03-16 22:55:26 +03:00
Dmitry Stogov
a5637221ee Update IR (#21462)
IR commit: 7fed7999743ba6a5ffc5535e786725d5577f6f34
2026-03-16 22:55:03 +03:00
Dmitry Stogov
c43880587b Update IR (#21462)
IR commit: 7fed7999743ba6a5ffc5535e786725d5577f6f34
2026-03-16 22:52:40 +03:00
Dmitry Stogov
0bd3a6b7f2 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix support for TAILCALL VM
  Fix GH-21267: JIT infinite loop on FETCH_OBJ_R with IS_UNDEF property (#21368)
2026-03-16 21:58:32 +03:00
Dmitry Stogov
00ff93d660 Fix support for TAILCALL VM 2026-03-16 21:57:40 +03:00
Dmitry Stogov
81504d3db7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-21267: JIT infinite loop on FETCH_OBJ_R with IS_UNDEF property (#21368)
2026-03-16 21:32:27 +03:00
Ilia Alshanetsky
e1a3a4c9a4 Fix GH-21267: JIT infinite loop on FETCH_OBJ_R with IS_UNDEF property (#21368)
When the JIT defers the IS_UNDEF check for FETCH_OBJ_R to the result
type guard, the deoptimization escape path dispatches to opline->handler
via the trace_escape stub. If opline->handler has been overwritten with
JIT code (e.g. a function entry trace), this creates an infinite loop.

Fix by dispatching to the original VM handler (orig_handler from the
trace extension) instead of going through the trace_escape stub. This
avoids the extra IS_UNDEF guard on every property read while correctly
handling the rare IS_UNDEF case during deoptimization.

Also set current_op_array in zend_jit_trace_exit_to_vm so that the
blacklisted exit deoptimizer can resolve orig_handler, covering the
case where side trace compilation is exhausted.

Closes GH-21368.
2026-03-16 21:31:49 +03:00
Dmitry Stogov
79556df7ee Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix GH-20838: JIT compiler produces wrong arithmetic results (#21383)
2026-03-11 15:23:22 +03:00
Dmitry Stogov
35ee95a827 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-20838: JIT compiler produces wrong arithmetic results (#21383)
2026-03-11 15:23:12 +03:00
Ilia Alshanetsky
80dc4c19d6 Fix GH-20838: JIT compiler produces wrong arithmetic results (#21383)
Insert type guards (CHECK_OP1_TRACE_TYPE / CHECK_OP2_TRACE_TYPE) on the
sensitive bailout paths in ADD/SUB/MUL JIT compilation: the MAY_BE_UNDEF
and non-numeric operand breaks. Guards are only emitted when the traced
operand type is IS_LONG or IS_DOUBLE, ensuring TSSA result type
predictions stay valid for side traces without affecting the normal
numeric fast path.


Fixes GH-20838

Co-authored-by: Dmitry Stogov <dmitrystogov@gmail.com>
2026-03-11 15:22:50 +03:00
Alexandre Daubois
11a95749b1 Convert more zend_parse_parameters_none() to fast ZPP (#21330) 2026-03-04 14:07:46 +01:00
Peter Kokot
f17c5ad83b Windows build: Add new function CHECK_HEADER() (#21191)
The current function `CHECK_HEADER_ADD_INCLUDE()` automatically defines
`HAVE_<HEADER_NAME_H>` preprocessor macros, which makes it difficult to
sync with other build systems. Specially, if some `HAVE_` macro is used
in the code and this function defines this macro but Autotools doesn't.

The new `CHECK_HEADER()` function behaves similar except it doesn't
define the `HAVE_<HEADER_NAME_H>` preprocessor macro.

This removes the following unused compile definitions:

HAVE_ARGON2_H
HAVE_AVIF_H
HAVE_BZLIB_H
HAVE_CAPSTONE_CAPSTONE_H
HAVE_CURL_EASY_H
HAVE_DB_H
HAVE_DECODE_H
HAVE_DEPOT_H
HAVE_EDITLINE_READLINE_H
HAVE_ENCHANT_H
HAVE_ENCODE_H
HAVE_FFI_H
HAVE_FIREBIRD_INTERFACE_H
HAVE_FT2BUILD_H
HAVE_GD_H
HAVE_GLIB_H
HAVE_GMP_H
HAVE_HTTPD_H
HAVE_IBASE_H
HAVE_IR_IR_H
HAVE_KECCAKHASH_H
HAVE_LBER_H
HAVE_LDAP_H
HAVE_LIBEXSLT_EXSLT_H
HAVE_LIBINTL_H
HAVE_LIBPQ_FE_H
HAVE_LIBTIDY_TIDY_H
HAVE_LIBXML_PARSER_H
HAVE_LIBXML_TREE_H
HAVE_LIBXML_XMLWRITER_H
HAVE_LIBXSLT_XSLT_H
HAVE_LMDB_H
HAVE_MBSTRING_H
HAVE_MYSQL_H
HAVE_ONIGURUMA_H
HAVE_OPENSSL_SSL_H
HAVE_PNG_H
HAVE_SNMP_H
HAVE_SODIUM_H
HAVE_SQLITE3_H
HAVE_SQLITE3EXT_H
HAVE_SYBFRONT_H
HAVE_TIDY_H
HAVE_TIDY_TIDY_H
HAVE_TIDYBUFFIO_H
HAVE_TIMELIB_CONFIG_H
HAVE_UNICODE_USPOOF_H
HAVE_UNICODE_UTF_H
HAVE_XPM_H
HAVE_ZIP_H
HAVE_ZIPCONF_H
HAVE_ZLIB_H

The following compile definitions are defined explicitly:

- HAVE_ICONV_H
- HAVE_MSCOREE_H
- HAVE_SQL_H
- HAVE_SQLEXT_H

Additionally, the `SETUP_OPENSSL()` function doesn't accept the 6th
argument anymore.
2026-03-03 20:06:40 +01:00
Dmitry Stogov
031b4c66c4 Merge branch 'PHP-8.5'
* PHP-8.5:
  Update IR
2026-02-25 17:19:52 +03:00
Dmitry Stogov
908723ad09 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update IR
2026-02-25 17:19:41 +03:00
Dmitry Stogov
f073425426 Update IR
IR commit: d8fbd3b198007f633a255b855cad036758deefb6

Fixes function JIT failures introduced by e792511179
2026-02-25 17:18:25 +03:00
Ilija Tovilo
4156b52296 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix preloaded constant erroneously propagated to file-cached script
2026-02-24 17:31:08 +01:00
Ilija Tovilo
8206eb1cb4 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix preloaded constant erroneously propagated to file-cached script
2026-02-24 17:30:14 +01:00
Ilija Tovilo
ec5a1e001d Fix preloaded constant erroneously propagated to file-cached script
Since GH-15021 preloaded constants are propagated to compiled scripts. This is
problematic for file cache, which assumes all referenced zvals are either
persistently allocated or local to the current script. However, preloaded
constants live in shm as immutable, but not persistent.

To solve this, we'd need to duplicate propagated constants in the optimizer when
file cache is used. This is error prone given it needs to happen in many places.
It's debatable whether constant propagation is even correct in this case, as
running the preloaded script on a restart isn't guaranteed to produce the same
result.

Hence, avoid the issue for now by just not relying on preloaded symbols when
file cache is used.

Fixes GH-21052
Closes GH-21281
2026-02-24 17:28:56 +01:00
Dmitry Stogov
68d96e3855 Merge branch 'PHP-8.5'
* PHP-8.5:
  Update IR (#21288)
2026-02-24 18:41:57 +03:00
Dmitry Stogov
ff73aecc95 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update IR (#21288)
2026-02-24 18:41:43 +03:00
Dmitry Stogov
e792511179 Update IR (#21288)
IR commit: ef9341183cdd0489a188a87e74f5b02a359df21b
2026-02-24 18:40:53 +03:00
Ilija Tovilo
db0e365f5a Fix missing reference unwrap for FE_FETCH_R in JIT (GH-21265)
Fixes GH-21264
2026-02-24 02:15:07 +01:00
Ilija Tovilo
94c8e01a06 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix borked SCCP of array containing partial object
2026-02-17 18:12:15 +01:00
Ilija Tovilo
1da4480852 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix borked SCCP of array containing partial object
2026-02-17 18:12:09 +01:00
Ilija Tovilo
1931472f22 Fix borked SCCP of array containing partial object
In SCCP, arrays containing partial objects must be marked as partial so that
their values are not accidentally propagated.

Fixes GH-21227
Closes GH-21232
2026-02-17 18:11:28 +01:00
Dmitry Stogov
90e4f1a9e5 Merge branch 'PHP-8.5'
* PHP-8.5:
  Update IR (#21183)
2026-02-10 01:35:01 +03:00
Dmitry Stogov
7273aa39c9 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Update IR (#21183)
2026-02-10 01:34:45 +03:00
Dmitry Stogov
dd9421d825 Update IR (#21183)
IR commit: a098f9ed6c2f1c2852d6c0921283212aafb4afed
2026-02-10 01:34:09 +03:00
Ilija Tovilo
8bb2312fc5 Merge branch 'PHP-8.5'
* PHP-8.5:
  Improve shared_alloc_shm.c strategy to support OPcache JIT on Solaris
2026-02-09 14:59:04 +01:00
Ilija Tovilo
81de7b964f Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Improve shared_alloc_shm.c strategy to support OPcache JIT on Solaris
2026-02-09 14:58:57 +01:00
Petr Sumbera
7c6f08945f Improve shared_alloc_shm.c strategy to support OPcache JIT on Solaris
The SysV shared memory allocator in OPcache hardcodes a maximum segment size of
32MB (SEG_ALLOC_SIZE_MAX). If the JIT buffer exceeds this, which it does with
the default 64MB size, startup will fail with "Insufficient shared memory!".

The allocator will now try allocating a contiguous buffer first, and only then
use segmentation by searching for continuously smaller powers of 2.

Fixes GH-20718
Closes GH-20719
2026-02-09 14:58:13 +01:00
Ilija Tovilo
fcff846a73 Fix borked FETCH_W+ZEND_FETCH_GLOBAL_LOCK optimization (GH-21121)
Fixes OSS-Fuzz #481014628
Introduced in GH-20628

Co-authored-by: Arnaud Le Blanc <365207+arnaud-lb@users.noreply.github.com>
2026-02-09 13:22:35 +01:00
Ilija Tovilo
fcb50e4d62 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix OSS-Fuzz #478009707 for JIT
2026-02-08 16:47:06 +01:00
Ilija Tovilo
ba6df41144 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix OSS-Fuzz #478009707 for JIT
2026-02-08 16:46:52 +01:00
Ilija Tovilo
bbde9c8178 Fix OSS-Fuzz #478009707 for JIT
This issue was already fixed in GH-21124, but some JIT paths were missing.

Closes GH-21151
2026-02-08 16:46:08 +01:00
Tim Düsterhus
a15ba7672c zend_ini: Make ZEND_INI_GET_ADDR() return a void* pointer (#21119)
* zend_ini: Make `ZEND_INI_GET_ADDR()` return a `void*` pointer

Since the actual type of the storage location is not known, a `void*` is more
appropriate and avoids explicit casts that are no more safe than the implicit
cast from `void*`.

* tree-wide: Remove explicit casts of `ZEND_INI_GET_ADDR()`

* UPGRADING.INTERNALS
2026-02-04 11:11:11 +01:00
Ilija Tovilo
6173a9a109 VAR|TMP overhaul (GH-20628)
The aim of this PR is twofold:

- Reduce the number of highly similar TMP|VAR handlers
- Avoid ZVAL_DEREF in most of these cases

This is achieved by guaranteeing that all zend_compile_expr() calls, as well as
all other compile calls with BP_VAR_{R,IS}, will result in a TMP variable. This
implies that the result will not contain an IS_INDIRECT or IS_REFERENCE value,
which was mostly already the case, with two exceptions:

- Calls to return-by-reference functions. Because return-by-reference functions
  are quite rare, this is solved by delegating the DEREF to the RETURN_BY_REF
  handler, which will examine the stack to check whether the caller expects a
  VAR or TMP to understand whether the DEREF is needed. Internal functions will
  also need to adjust by calling the zend_return_unwrap_ref() function.

- By-reference assignments, including both $a = &$b, as well as $a = [&$b]. When
  the result of these expressions is used in a BP_VAR_R context, the reference
  is unwrapped via a ZEND_QM_ASSIGN opcode beforehand. This is exceptionally
  rare.

Closes GH-20628
2026-01-31 19:44:56 +01:00
Alexandre Daubois
e4935cf601 Merge branch 'PHP-8.5'
* PHP-8.5:
  Core: fix missing deprecation when accessing null array key with JIT (#20883)
2026-01-30 16:19:57 +01:00
Alexandre Daubois
4a6e6077ef Core: fix missing deprecation when accessing null array key with JIT (#20883) 2026-01-30 16:18:33 +01:00
cui
7fed075ba6 [skip ci] typo: sucess* to success* (GH-21092) 2026-01-30 14:28:48 +01:00
Ilija Tovilo
db24ca5926 Merge branch 'PHP-8.5'
* PHP-8.5:
  Fix segfault when preloading constant AST closure
2026-01-29 13:31:38 +01:00
Ilija Tovilo
2f2b421a48 Fix segfault when preloading constant AST closure
Fixes GH-21059
Closes GH-21071
2026-01-29 13:30:41 +01:00
Tim Düsterhus
6a17febe6c zend_compile: Fix array_map() optimization (#21016)
* zend_compile: Fix handling of PFA syntax in array_map() optimization

PFA is not implemented and the syntax is rejected at compile-time, thus it was
assumed the assertion would be unreachable. However the check for PFA syntax
happens after compiling special functions, making it reachable. Fix this by
gracefully returning FAILURE which will then correctly emit the error during
the compilation of the normal call.

Fixes php/php-src#20991.

* zend_compile: Fix array_map() optimization for dynamic function names

Fixes php/php-src#20990.

* zend_compile: Adjust array_map() optimization after review feedback
2026-01-26 08:59:30 +01:00
Arnaud Le Blanc
65b4073922 Include the actual stub name in generated arginfo headers (#20993) 2026-01-21 20:57:00 +01:00
Ilija Tovilo
95f7e30f4c [skip ci] Fix tmps= count in variation build
Observers add an extra tmp, breaking the expected output.
2026-01-21 16:57:05 +01:00