Commit graph

68048 commits

Author SHA1 Message Date
Niels Dossche
a165f1fffc
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-15169: stack overflow when var serialization in ext/standard/var
2024-10-02 21:32:50 +02:00
Niels Dossche
577eb68212
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15169: stack overflow when var serialization in ext/standard/var
2024-10-02 21:32:20 +02:00
Niels Dossche
bd724bdf42
Fix GH-15169: stack overflow when var serialization in ext/standard/var
Adding a stack check here as I consider serialization to be a more
sensitive place where erroring out with an exception seems appropriate.

Closes GH-16159.
2024-10-02 21:30:59 +02:00
Dmitry Stogov
3f913c123a
Implement JIT for ZEND_FETCH_STATIC_PROP_* and improve interpretation (#16157)
* Implement JIT for ZEND_FETCH_STATIC_PROP_* and improve interpretation

* Revert incorrect change

* Use FASTCALL calling convention

* Use EMPTY_SWITCH_DEFAULT_CASE

* Move the loading of the property info into zend_jit_uninit_static_prop()
2024-10-02 21:02:33 +03:00
Dmitry Stogov
83bbf4b339
Merge branch 'PHP-8.4'
* PHP-8.4:
  Improve JIT TRACE coverage (#16171)
2024-10-02 19:27:52 +03:00
Dmitry Stogov
ddc49153f1
Improve JIT TRACE coverage (#16171)
Now it's possible that PHP tracing JIT loses some parts of the "hot"
code. In case we have a root LOOP trace with an inlined call of some
function, and we get a SIDE exit inside that function - we recorded a
side trace, but finished it a the RETURN of the inlined function. As
result the opcodes betwee RETURN from SIDE trace and LOOP exit were not
covered by tracer and were executed in interpreter.

This patch introduces a "ret_depth" argument that prevents stopping
tracing on RETURN of such SIDE trace.
2024-10-02 19:27:31 +03:00
Gina Peter Banyard
d7bdf902e5
ext/phar: Remove phar_resolve_alias() (#15860)
As this is unused and a SourceGraph search returns 0 result
2024-10-02 15:44:05 +01:00
Arnaud Le Blanc
e504df830c
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] NEWS for GH-16061
  Fix array_merge_recursive(): convert_to_array() may need separation (#16061)
2024-10-02 12:44:10 +02:00
Arnaud Le Blanc
3952a8f9f1
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  [ci skip] NEWS for GH-16061
  Fix array_merge_recursive(): convert_to_array() may need separation (#16061)
2024-10-02 12:44:00 +02:00
Arnaud Le Blanc
220c8828cc
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  [ci skip] NEWS for GH-16061
  Fix array_merge_recursive(): convert_to_array() may need separation (#16061)
2024-10-02 12:43:48 +02:00
Arnaud Le Blanc
545bef8ae6
Fix array_merge_recursive(): convert_to_array() may need separation (#16061) 2024-10-02 12:37:04 +02:00
Niels Dossche
f1b41d790d
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16151: Assertion failure in ext/dom/parentnode/tree.c
2024-10-01 21:48:12 +02:00
Niels Dossche
341c26fc3f
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16151: Assertion failure in ext/dom/parentnode/tree.c
2024-10-01 21:47:52 +02:00
Niels Dossche
cd67c090a9
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  Fix GH-16151: Assertion failure in ext/dom/parentnode/tree.c
2024-10-01 21:47:26 +02:00
Niels Dossche
066d18f2e8
Fix GH-16151: Assertion failure in ext/dom/parentnode/tree.c
Unfortunately, old DOM allows attributes to be used as parent nodes.
Only text nodes and entities are allowed as children for these types of
nodes, because that's the constraint DOM and libxml give us.

Closes GH-16156.
2024-10-01 21:46:12 +02:00
Niels Dossche
921a1e3dc1
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-16149: Null pointer dereference in DOMElement->getAttributeNames()
2024-10-01 21:04:22 +02:00
Niels Dossche
853322faab
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-16149: Null pointer dereference in DOMElement->getAttributeNames()
2024-10-01 21:03:31 +02:00
Niels Dossche
63e1ebe78d
Fix GH-16149: Null pointer dereference in DOMElement->getAttributeNames()
A namespace without a prefix is by definition always the "xmlns"
namespace.

Closes GH-16155.
2024-10-01 21:02:23 +02:00
Gina Peter Banyard
e8e4d36bc9 ext/ldap: Rename variable and move closer to usage site 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
0733e90c7f ext/ldap: Check that array key is not empty 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
72ee812e2a ext/ldap: Check array key does not have any nul bytes 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
d34d015078 ext/ldap: Promote warning to ValueError if array is not a dict 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
127968b1e4 ext/ldap: Refactor loop to a HASH_FOREACH loop 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
34e9d9ee41 ext/ldap: Zero out arrays and traverse them as NULL terminated list 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
304a514863 ext/ldap: Use HASH_FOREACH macro 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
8a9aa08de7 ext/ldap: Reduce scope of variables 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
db57561479 ext/ldap: Check that attribute values is a list before traversal 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
9e91810807 ext/ldap: Ensure list of attribute values is not empty 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
09ffa28224 ext/ldap: Handle attribute => value case directly 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
08bf506953 ext/ldap: php_ldap_do_modify() throw ValueError when entries array is empty 2024-10-01 19:57:47 +01:00
Gina Peter Banyard
3a2a86b525 ext/ldap: Add tests for php_ldap_do_modify()
And also amend some existing tests which would duplicate coverage
2024-10-01 19:57:47 +01:00
David Carlier
e609a21906
ext/pgsql: pgsql_copy_from to support iterable.
inspired from the Pdo\Pgsql new feature GH-15893.

close GH-16124
2024-10-01 19:53:20 +01:00
Niels Dossche
4a1694090b
[ci skip] Skip test under ASAN
We backport 1d0fb36681 to PHP-8.3.
2024-10-01 13:58:40 +02:00
Gina Peter Banyard
a6d111ff2a
Merge branch 'PHP-8.4'
* PHP-8.4:
  NEWS entries for LDAP bug fixes
  ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify())
  ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
2024-09-30 22:24:45 +01:00
Gina Peter Banyard
747860ccf0
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  NEWS entries for LDAP bug fixes
  ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify())
  ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
2024-09-30 22:24:39 +01:00
Gina Peter Banyard
10b5d4beb5
Merge branch 'PHP-8.2' into PHP-8.3
* PHP-8.2:
  NEWS entries for LDAP bug fixes
  ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify())
  ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
2024-09-30 22:24:08 +01:00
Gina Peter Banyard
21260318c6
ext/ldap: Fix GH-16136 (Memory leak in php_ldap_do_modify()) 2024-09-30 22:23:01 +01:00
Gina Peter Banyard
c910e78c39
ext/ldap: Fix GH-16132 (Freeing pointer not allocated by ZMM)
Closes GH-16134
2024-09-30 22:23:01 +01:00
Niels Dossche
acf1a6cfa0
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix typo
2024-09-30 23:05:38 +02:00
Niels Dossche
bf1021c1a8
Fix typo 2024-09-30 23:05:30 +02:00
Niels Dossche
c65bb64cba
Merge branch 'PHP-8.4'
* PHP-8.4:
  [ci skip] Skip test under ASAN
2024-09-30 22:46:12 +02:00
Niels Dossche
1d0fb36681
[ci skip] Skip test under ASAN 2024-09-30 22:46:05 +02:00
Niels Dossche
494aa65f24
Merge branch 'PHP-8.4'
* PHP-8.4:
  Fix GH-15168: stack overflow in json_encode()
2024-09-30 20:43:39 +02:00
Niels Dossche
95d691ae00
Merge branch 'PHP-8.3' into PHP-8.4
* PHP-8.3:
  Fix GH-15168: stack overflow in json_encode()
2024-09-30 20:43:32 +02:00
Niels Dossche
a551b99b2c
Fix GH-15168: stack overflow in json_encode()
The JSON encoder is recursive, and it's far from easy to make it
iterative. Add a cheap stack limit check to prevent a segfault.
This uses the PHP_JSON_ERROR_DEPTH error code that already talks about
the stack depth. Previously this was only used for the $depth argument.

Closes GH-16059.
2024-09-30 20:42:01 +02:00
Niels Dossche
daa94cf279
Implement request #30622: make $namespace parameter functional
This parameter never actually did anything and was forgotten about.
We solve this by detecting when we have a $namespace argument
(that won't conflict with the name argument) and creating a Clark
notation name out of it.

Closes GH-16123.
2024-09-30 20:34:51 +02:00
Niels Dossche
f5e81fe182
Optimize in-memory XMLWriter
We're currently using a libxml buffer, which requires copying the buffer
to zend_strings every time we want to output the string. Furthermore,
its use of the system allocator instead of ZendMM makes it not count
towards the memory_limit and hinders performance.

This patch adds a custom writer such that the strings are written to a
smart_str instance, using ZendMM for improved performance, and giving
the ability to not copy the string in the common case where flush has
empty set to true.

Closes GH-16120.
2024-09-30 20:30:03 +02:00
Niels Dossche
63e0b9ccbf
Fix #49169: SoapServer calls wrong function, although "SOAP action" header is correct
Although the original reproducer no longer exists, I was able to cook up
something similar.
The problem is that there are two ways ext-soap currently looks up
functions:
1) By matching the exact function name; but this doesn't work if the
   function name is not in the body.
2) By matching the parameter names.

Neither of these work when we don't have the function name in the body,
and when the parameter names are not unique. That's where we can use the
"SOAPAction" header to distinguish between different actions. This header
should be checked first and be matched against the "soapAction"
attribute in the WSDL. We keep the existing fallbacks such that the
chance of a BC break is minimized.
Note that since #49169 a potential target namespace is ignored right
now.

Closes GH-15970.
2024-09-30 20:14:34 +02:00
Niels Dossche
6cf467cc9f
Soap: Document how the current lookup functions work 2024-09-30 20:14:10 +02:00
Niels Dossche
f538319263
Soap: Split up an if condition into a nested if
This is in preparation for adding functionality in later commits.
2024-09-30 20:14:10 +02:00