Commit graph

19580 commits

Author SHA1 Message Date
Demon
2be3aa86f0
Zend: fix undefined symbol 'execute_ex' on Windows ARM64 #19064; ext/gd: fix emmintrin.h not found on Windows ARM64 2025-07-10 22:13:29 +02:00
Peter Kokot
ab6e73066b
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix -Wuseless-escape warnings emitted by re2c (#19050)
2025-07-07 09:51:50 +02:00
Peter Kokot
258fbd6bf9
Fix -Wuseless-escape warnings emitted by re2c (#19050)
re2c version 4 enabled some warnings by default. This fixes re2c code
for the `-Wuseless-escape` warnings.

There are two same issues reported.
Issue: GH-17523
Closes: GH-17204
2025-07-07 09:51:25 +02:00
Niels Dossche
1af7d8e547
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #428983568 and #428760800
2025-07-04 23:58:33 +02:00
Niels Dossche
4aac98f145
Fix OSS-Fuzz #428983568 and #428760800
Both these issues have the same root cause, their reproducer is
extremely similar so I don't duplicate the test.

If the parser invokes the lexer, and the lexer fails, it could've
allocated a string which must be freed when the parser backs up.
The `%destructor` list is responsible for this but did not have an entry
for `fallback` yet. Solve the issue by adding such an entry.

Closes GH-19012.
2025-07-04 23:58:06 +02:00
Saki Takamachi
d5fe1bce63
PHP-8.4 is now for PHP 8.4.11-dev 2025-07-02 11:39:33 +09:00
Niels Dossche
5d590a1e87
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #427814456
2025-07-01 18:52:39 +02:00
Niels Dossche
91749844e6
Fix OSS-Fuzz #427814456
The first warning may trigger an error handler, destroying the operand
and its string. So we need to protect the string in that case.
Care was taken to avoid unnecessary refcounts and to avoid touching the
hot code path.

Closes GH-18951.
2025-07-01 18:50:41 +02:00
Shivam Mathur
a8bd3ba1bb
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-25 03:22:43 +05:30
Shivam Mathur
ac15486ae0
Fix CI for windows-2022
This is a continuation of GH-18927 to fix CI for windows-2022
2025-06-25 03:20:49 +05:30
Niels Dossche
f77c04d007
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix RCN violations in array functions
2025-06-24 23:29:50 +02:00
Niels Dossche
359a21f102
Fix RCN violations in array functions
When the array functions perform their operation in-place, the
`@refcount 1` annotation is wrong and causes a failure under
`ZEND_VERIFY_FUNC_INFO`.
The test file tests all functions that have the in-place optimization,
even those that didn't have the refcount annotation, just to prevent
future regressions.

Closes GH-18929.
2025-06-24 23:29:00 +02:00
Shivam Mathur
d2a30acf33
Merge branch 'PHP-8.3' into PHP-8.4 2025-06-25 02:01:59 +05:30
Shivam Mathur
dc79f4c8c6
Merge branch 'PHP-8.2' into PHP-8.3 2025-06-25 02:01:24 +05:30
Shivam Mathur
91f2458020
Merge branch 'PHP-8.1' into PHP-8.2 2025-06-25 02:00:11 +05:30
Shivam Mathur
6233dc6210
Switch to windows-2022 in CI (#18927)
* Switch to windows-2022 in CI

windows-2019 runner will be dropped by GitHub on 2025-06-30.

* xfail test cases that fail on windows-2022
2025-06-25 01:57:07 +05:30
Ilija Tovilo
fe504d3357
Fix leak when creating cycle in hook
This is necessary because the VM frees operands with the nogc variants. We
cannot just call gc_possible_root() because the object may no longer exist at
that point.

Fixes GH-18907
Closes GH-18917
2025-06-23 17:48:07 +02:00
Ilija Tovilo
0ee73ccbe5
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Track heap->real_size for USE_TRACKED_ALLOC
2025-06-20 14:51:20 +02:00
Ilija Tovilo
dfc4caa1e4
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Track heap->real_size for USE_TRACKED_ALLOC
2025-06-20 14:51:00 +02:00
Ilija Tovilo
7841c8a3df
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Track heap->real_size for USE_TRACKED_ALLOC
2025-06-20 14:49:47 +02:00
Ilija Tovilo
9cacc57350
Track heap->real_size for USE_TRACKED_ALLOC
real_size is returned by memory_get_usage(true), which previously returned 0.
Discovered in Symfony ConsumeMessagesCommandTest::testRunWithMemoryLimit()
through nightly.

Closes GH-18880
2025-06-20 14:48:47 +02:00
Niels Dossche
bb6263af60
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix use after free during shutdown destruction
2025-06-18 21:20:25 +02:00
Daniil Gentili
5cf3c2663b
Fix use after free during shutdown destruction
Closes GH-18834.
2025-06-18 21:20:03 +02:00
Eric Mann
50606f8569
PHP 8.3 is now for PHP 8.3.24-dev 2025-06-17 08:06:35 -07:00
Saki Takamachi
a6749046f6
PHP-8.4 is now for PHP 8.4.10-dev 2025-06-17 21:05:02 +09:00
Niels Dossche
fc89d1968c
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  zend_alloc: Fix compile with ZEND_MM_STAT=0
2025-06-09 17:28:06 +02:00
Niels Dossche
d11f9717fd
zend_alloc: Fix compile with ZEND_MM_STAT=0
Closes GH-18811.
2025-06-09 17:27:39 +02:00
Niels Dossche
5526301908
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  pdo_odbc: Fix memory leak if WideCharToMultiByte() fails
  Fix memory leak on php_odbc_fetch_hash() failure
  Do not delete main chunk in zend_gc
2025-06-09 11:25:41 +02:00
Daniil Gentili
9a9d98e02f
Do not delete main chunk in zend_gc
Closes GH-18756.

Co-authored-by: Arnaud Le Blanc <arnaud.lb@gmail.com>
2025-06-09 11:23:29 +02:00
Niels Dossche
976143e365
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix compile without ZEND_MM_STORAGE
2025-06-05 21:51:38 +02:00
Niels Dossche
4162c20787
Fix compile without ZEND_MM_STORAGE 2025-06-05 21:51:30 +02:00
Niels Dossche
2b383848a7
Fix handling of references in zval_try_get_long()
This API can't handle references, yet everyone keeps forgetting that it
can't and that you should DEREF upfront. Fix every type of this issue
once and for all by moving the reference handling to this Zend API.

Closes GH-18761.
2025-06-04 21:00:05 +02:00
Nikita Popov
d66e87b02e Fix line assignment in zend_ast_create_va()
The intent here was to assign the first found line. Instead this
always fell back to CG(zend_lineno).

Not sure if this line matters for anything in php-src, but the
issue was observed in https://github.com/nikic/php-ast/issues/247.
2025-06-01 20:35:35 +02:00
Máté Kocsis
08b616e2f5
Backport relevant changes of https://github.com/php/php-src/pull/18719
These property writes may now throw exceptions because of property hooks, and this was not handled previously.
2025-05-31 22:31:48 +02:00
Daniel Scherzer
e44c13cffe
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-18695: float numbers zero fraction is now preserved in zend_ast_export() (#18699)
2025-05-29 13:48:38 -07:00
Oleg Efimov
087f38f347
Fix GH-18695: float numbers zero fraction is now preserved in zend_ast_export() (#18699) 2025-05-29 13:46:11 -07:00
DanielEScherzer
cd751f98cb
Reapply GH-17712 with a fix for internal class constants (#18464)
Add recursion protection when emitting deprecation warnings for class
constants, since the deprecation message can come from an attribute that is
using the same constant for the message, or otherwise result in recursion.

But, internal constants are persisted, and thus cannot have recursion
protection. Otherwise, if a user error handler triggers bailout before the
recursion flag is removed then a subsequent request (e.g. with `--repeat 2`)
would start with that flag already applied. Internal constants can presumably
be trusted not to use deprecation messages that come from recursive attributes.

Fixes GH-18463
Fixes GH-17711
2025-05-25 16:43:36 -07:00
Máté Kocsis
bc32d806dd
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix build on Apple Clang 17+ (#18629)
2025-05-24 22:30:02 +02:00
Máté Kocsis
772479ea2f
Fix build on Apple Clang 17+ (#18629)
Fixing "invalid cpu feature string for builtin" errors that started to appear on Apple Clang 17.0.0
2025-05-24 22:26:06 +02:00
Jakub Zelenka
8e2c2be7a5
PHP-8.3 is now for PHP 8.3.23-dev 2025-05-21 00:39:56 +02:00
Calvin Buckley
3e0a4259a8
PHP 8.4 is now for PHP-8.4.9-dev 2025-05-20 13:13:34 -03:00
Niels Dossche
6b795f64a5
Fix GH-18534: FPM exit code 70 with enabled opcache and hooked properties in traits
The trait handling for property hooks in preloading did not exist, we
add a check to skip trait clones and we add the necessary code to update
the op arrays.

Closes GH-18586.
2025-05-19 19:21:53 +02:00
Niels Dossche
08cba2dcc1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix OSS-Fuzz #418106144
  Fix OSS-Fuzz #417078295
2025-05-19 19:07:17 +02:00
Niels Dossche
98cb17f4fd
Fix OSS-Fuzz #418106144
The VM assumes that an exception must be handled when the AST evaluation
returns FAILURE. However, the comparison functions always return SUCCESS
even if an exception happened. This can be fixed in
zend_ast_evaluate_inner() or we can make is_smaller_function() etc check
for the exception. I chose the former to avoid impact or API breaks.
Perhaps in the future the comparison functions should either return void
or return whether an exception happened, as to be not misleading.

Closes GH-18589.
2025-05-19 19:05:32 +02:00
Niels Dossche
46ac878f6a
Fix OSS-Fuzz #417078295
If the variable_ptr and fetched value are the same or overlap, then we
get a UAF. Prevent this by delaying destruction.

Closes GH-18588.
2025-05-19 19:04:58 +02:00
Levi Morrison
59e6165fa6
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-19 09:53:15 -06:00
Levi Morrison
35455b17be
fix: dangling opline in ZEND_INIT_ARRAY (#18578)
This causes problems if an allocation profiler decides to walk the
stack, or if the engine itself OOMs on this opcode, and it tries to
print file and line information.
2025-05-19 09:45:28 -06:00
David Carlier
68abc19229
Follow-up on GH-18577, adjust new test due to change on nested objects. 2025-05-17 12:46:27 +01:00
David Carlier
e4e71215d6
Merge branch 'PHP-8.3' into PHP-8.4 2025-05-17 12:45:13 +01:00
David Carlier
88d6e7c238
fix regex typo for GH-18577 new test 2025-05-17 12:44:57 +01:00