149811 Commits
Author SHA1 Message Date
Marc 0a98b97933 TSRM: attach pthread_key/fls callbacks for thread cleanup (#24428)
SAPI's should already been doing this on their own before, but the apache2handler doesn't get control over threads, so it didn't call ts_free_thread and therefore started leaking resources with the move of per-thread globals from heap storage to native __thread storage
2026-10-28 09:30:38 +01:00
Arnaud Le Blanc 94c2ad2f3b Merge branch 'PHP-8.6'
* PHP-8.6:
  JIT: fix vm_interrupt resumption in TAILCALL/CALL VMs (#24793)
2026-10-28 09:28:26 +01:00
Arnaud Le Blanc 37999c737a Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  JIT: fix vm_interrupt resumption in TAILCALL/CALL VMs (#24793)
2026-10-28 09:28:15 +01:00
Levi Morrison 8975c59b17 JIT: fix vm_interrupt resumption in TAILCALL/CALL VMs (#24793)
In the CALL and TAILCALL VMs, opcode handlers called by function JIT
can return the next opline tagged with ZEND_VM_ENTER_BIT after invoking
a VM interrupt callback. Function JIT used that result directly as an
opcode pointer, causing invalid accesses when execution continued.
2026-10-28 09:27:33 +01:00
Weilin Du c2907d2875 Merge branch 'PHP-8.6'
* PHP-8.6:
  Merge branch 'PHP-8.5' into PHP-8.6
  Fix IntlDateFormatter parse functions truncating an $offset below INT_MIN (#24781)
2026-10-28 16:11:38 +08:00
Weilin Du e427f87653 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Merge branch 'PHP-8.4' into PHP-8.5
  Fix IntlDateFormatter parse functions truncating an $offset below INT_MIN (#24781)
2026-10-28 16:10:58 +08:00
Weilin Du 32b16a07d6 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix IntlDateFormatter parse functions truncating an $offset below INT_MIN (#24781)
2026-10-28 16:08:58 +08:00
Marc Bennewitz a07ae61b36 Fix IntlDateFormatter parse functions truncating an $offset below INT_MIN (#24781)
Check both bounds before narrowing the parse offset to int32_t. On 64-bit
systems, a value such as -4294967295 previously became 1 and parsing
started at the wrong position. Cover all three parse functions with a
regression test.

Closes #24781
2026-10-28 16:07:15 +08:00
ndossche 8867746907 Merge branch 'PHP-8.6'
* PHP-8.6:
  Fix use-after-free in Randomizer::shuffleArray() when the engine throws
2026-10-28 08:25:23 +01:00
ndossche 30bcf4bd89 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Fix use-after-free in Randomizer::shuffleArray() when the engine throws
2026-10-28 08:25:17 +01:00
ndossche dbd6ed433d Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix use-after-free in Randomizer::shuffleArray() when the engine throws
2026-10-28 08:24:57 +01:00
Martin Mirchev 3a8bcb6d18 Fix use-after-free in Randomizer::shuffleArray() when the engine throws
php_array_data_shuffle() first compacts the holes of a packed array and
only then updates nNumUsed. When the engine threw in between, the stale
tail slots were still counted, so the moved values were released twice
when the copied array was destroyed. Update nNumUsed right after the
compaction.

Closes GH-24553.
2026-10-28 08:24:25 +01:00
Yuma Kakei 2295a3504a Fuzz exif thumbnail handling (#24722)
exif_read_data() only reads the thumbnail if $read_thumbnail is true,
and exif_thumbnail() only scans the thumbnail for its dimensions if they
are requested, so the exif fuzzer never reached this code.
2026-10-28 08:13:49 +01:00
David Carlier 758c9ac549 Merge branch 'PHP-8.6'
* PHP-8.6:
  ext/dom: fix UAF on namespace axis results with foreign-doc XPath callback nodes
2026-10-28 03:15:23 +00:00
David Carlier 3299d94c80 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  ext/dom: fix UAF on namespace axis results with foreign-doc XPath callback nodes
2026-10-28 03:15:22 +00:00
David Carlier d657f7a3c7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  ext/dom: fix UAF on namespace axis results with foreign-doc XPath callback nodes

# Conflicts:
#	ext/dom/xpath.c
2026-10-28 03:15:21 +00:00
David Carlier 98b580b0d2 ext/dom: fix UAF on namespace axis results with foreign-doc XPath callback nodes
Follow-up to https://github.com/php/php-src/pull/24570#issuecomment-6375965729

The namespace node branch of php_xpath_eval() still created the parent
element with the DOMXPath's own dom, so with a foreign-doc callback node
the parent proxy referenced the wrong document. Use
dom_xpath_intern_for_doc() there too.

Close GH-24629
2026-10-28 03:14:25 +00:00
Jorg Sowa 780f4e8217 Merge branch 'PHP-8.6'
* PHP-8.6:
  Fix AArch64 JIT encoding of invalid logical immediates
2026-10-27 22:38:11 +01:00
Jorg Sowa 7d6e9e6f59 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Fix AArch64 JIT encoding of invalid logical immediates
2026-10-27 22:37:35 +01:00
Jorg Sowa 0dd0c2faaf Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix AArch64 JIT encoding of invalid logical immediates
2026-10-27 22:37:13 +01:00
Jorg Sowa aa6e3a84e8 Fix AArch64 JIT encoding of invalid logical immediates
dasm_imm13() accepted some non-encodable constants and returned a bogus
encoding, so AND/OR/XOR with them computed a wrong result
(0x5555555555555554) or emitted an illegal instruction (0x200000003).
It also negated INT64_MIN in signed arithmetic. Backport the rewritten
dasm_imm13() from DynASM (LuaJIT a9981441), already in master via the
IR update.

Closes GH-24663.
2026-10-27 22:37:01 +01:00
Jorg Sowa 6d2196792c Merge branch 'PHP-8.6'
* PHP-8.6:
  Fix JIT SWITCH_STRING type checks on referenced operand
2026-10-27 22:33:06 +01:00
Jorg Sowa f852fb7bcd Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Fix JIT SWITCH_STRING type checks on referenced operand
2026-10-27 22:33:05 +01:00
Jorg Sowa c647ee5736 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix JIT SWITCH_STRING type checks on referenced operand
2026-10-27 22:33:02 +01:00
Jorg Sowa ef873f64f3 Fix JIT SWITCH_STRING type checks on referenced operand
The tracing guard checked IS_LONG instead of IS_STRING after ZVAL_DEREF,
passing a non-string to zend_hash_find(). The function JIT path checked
IS_STRING instead of IS_REFERENCE, so the deref fast path was dead.

Closes GH-24796.
2026-10-27 22:32:49 +01:00
ndossche beb8d76332 Merge branch 'PHP-8.6'
* PHP-8.6:
  curl: Fix UAF on clone due to callback data pointer mismatch
2026-10-27 20:44:39 +01:00
ndossche f8176205c7 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  curl: Fix UAF on clone due to callback data pointer mismatch
2026-10-27 20:44:34 +01:00
ndossche 625892b770 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  curl: Fix UAF on clone due to callback data pointer mismatch
2026-10-27 20:44:17 +01:00
ndossche 154b090df2 curl: Fix UAF on clone due to callback data pointer mismatch
When curl opaque objects are cloned, the curl handle was only updated if
the callback function wasn't null. However, the C handler in PHP remains
attached even if the callback was set to NULL (*). So we must
unconditionally update the callback data pointer to the new curl handle.

(*) We can't set the C handler to NULL unconditionally on stable branches
because that invokes a behaviour change (e.g. built in progress bar).

Closes GH-24760.
2026-10-27 20:43:46 +01:00
ndossche fb7fb98f68 Merge branch 'PHP-8.6'
* PHP-8.6:
  opcache: Call orig_post_shutdown_cb()
  JIT: Discard veneers if generation failed
2026-10-27 20:40:18 +01:00
ndossche 0c122cc676 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  opcache: Call orig_post_shutdown_cb()
  JIT: Discard veneers if generation failed
2026-10-27 20:40:12 +01:00
ndossche 07e5953b27 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  opcache: Call orig_post_shutdown_cb()
  JIT: Discard veneers if generation failed
2026-10-27 20:39:54 +01:00
ndossche 37f495c3f5 opcache: Call orig_post_shutdown_cb()
This was never called and resulted in this compiler warning:

```
./ext/opcache/ZendAccelerator.c:3720:15: warning: variable 'orig_post_shutdown_cb' set
      but not used [-Wunused-but-set-global]
 3720 | static void (*orig_post_shutdown_cb)(void);
      |               ^
```

Closes GH-24761.
2026-10-27 20:39:21 +01:00
ndossche 11bea59cfb JIT: Discard veneers if generation failed
This is the final part to fix GH-24675, after e356f985f1.

Closes GH-24675.
Closes GH-24765.
2026-10-27 20:38:48 +01:00
ndossche 1d901925f0 Merge branch 'PHP-8.6'
* PHP-8.6:
  [ci skip] Skip test for MSAN
2026-10-27 20:36:52 +01:00
ndossche 76c8a4d13e Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  [ci skip] Skip test for MSAN
2026-10-27 20:36:46 +01:00
ndossche 6c1559d0e5 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  [ci skip] Skip test for MSAN
2026-10-27 20:36:40 +01:00
ndossche de8c44e683 [ci skip] Skip test for MSAN 2026-10-27 20:36:09 +01:00
Maniix 2967edbbd4 Remove PIDFile from FPM service (#23671) 2026-10-27 18:58:24 +01:00
Jakub Zelenka d4eba0fff2 Merge branch 'PHP-8.6'
* PHP-8.6:
  fpm: fix _GET_str memory leaks and test headers_only status path
  fpm: fix a use-after-free of scoreboard_p
  fpm: fix potential null dereference in fpm_status_export_to_zval()

# Conflicts:
#	NEWS
2026-10-27 18:52:49 +01:00
Jakub Zelenka 2df07dd25e Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  fpm: fix _GET_str memory leaks and test headers_only status path
  fpm: fix a use-after-free of scoreboard_p
  fpm: fix potential null dereference in fpm_status_export_to_zval()
2026-10-27 18:52:12 +01:00
Jakub Zelenka 97fe7d69f6 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  fpm: fix _GET_str memory leaks and test headers_only status path
  fpm: fix a use-after-free of scoreboard_p
  fpm: fix potential null dereference in fpm_status_export_to_zval()
2026-10-27 18:52:11 +01:00
Marcel Hernandez 0e7e36c896 fpm: fix _GET_str memory leaks and test headers_only status path
Closes GH-23833
2026-10-27 18:50:07 +01:00
Marcel Hernandez 3aa4da4a20 fpm: fix a use-after-free of scoreboard_p 2026-10-27 18:49:55 +01:00
Marcel Hernandez ce3e1bac17 fpm: fix potential null dereference in fpm_status_export_to_zval() 2026-10-27 18:49:55 +01:00
Jakub Zelenka c5003a7b30 Merge branch 'PHP-8.6'
* PHP-8.6:
  Fix GH-24046: FPM worker stdio pipe fd closed twice

# Conflicts:
#	NEWS
2026-10-27 18:01:18 +01:00
Jakub Zelenka 1471453102 Merge branch 'PHP-8.5' into PHP-8.6
* PHP-8.5:
  Fix GH-24046: FPM worker stdio pipe fd closed twice

# Conflicts:
#	NEWS
2026-10-27 18:00:56 +01:00
Jakub Zelenka a5cb45ffa7 Merge branch 'PHP-8.4' into PHP-8.5
* PHP-8.4:
  Fix GH-24046: FPM worker stdio pipe fd closed twice
2026-10-27 18:00:25 +01:00
Ian P. Christianandndossche cd161267c0 Fix GH-24046: FPM worker stdio pipe fd closed twice
When a worker exits while one of its child processes still holds the
worker's stdout/stderr pipe open, the drain in fpm_child_close() gets
EAGAIN instead of EOF and leaves the fd open. fpm_child_close() then
closed the fd but kept its number in the child struct, so the postponed
free closed it (and removed its event) a second time. If a new worker
had been given the same fd number in the meantime, its pipe was closed
and every later write it made to stdio failed with EPIPE.

Remove the event and reset the fd to -1 when closing it in
fpm_child_close() so the postponed free cannot act on it again.

Closes GH-24056.

Co-authored-by: ndossche <7771979+ndossche@users.noreply.github.com>
2026-10-27 17:59:55 +01:00
Weilin Du af192515a9 Merge branch 'PHP-8.6'
* PHP-8.6:
  Merge branch 'PHP-8.5' into PHP-8.6
2026-10-28 00:45:35 +08:00