Commit graph

131876 commits

Author SHA1 Message Date
Dmitry Stogov
c796ce5713 Re-add GC_DTOR and GC_DTOR_NO_REF 2023-04-04 22:51:26 +03:00
Dmitry Stogov
d5484bf115 Remove includes 2023-04-04 22:48:26 +03:00
Dmitry Stogov
706a9b2a39 Revert "Zend/zend_types.h: move zend_result to separate header (#10609)"
This reverts commit 3bce116069.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
c9d728cbd6 Revert "Zend/zend_types.h: move zend_rc_debug to zend_rc_debug.h"
This reverts commit d6e95041e2.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
59905d8fc5 Revert "Zend/zend_rc_debug: convert ZEND_RC_MOD_CHECK() to function"
This reverts commit e509a66a9c.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
0e70693701 Revert "Zend/zend_types.h: move IS_* to zend_type_code.h"
This reverts commit 0270a1e54c.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
4f724accf8 Revert "Zend/zend_type_code.h: convert to enum"
This reverts commit b98f18e7c3.
2023-04-04 22:48:26 +03:00
Dmitry Stogov
e2f0ce9e06 Revert "Zend/zend_types.h: move zend_refcounted to zend_refcounted.h"
This reverts commit eb34c28fed.
2023-04-04 22:48:23 +03:00
Dmitry Stogov
61b19ba3f0 Revert "Zend/zend_types.h: move zend_uchar.h to zend_char.h"
This reverts commit 42577c6b6b.
2023-04-04 22:47:45 +03:00
Dmitry Stogov
ac3abe4579 Revert "Zend/zend_types.h: move zend_string to zend_string.h"
This reverts commit 02690fe3c0.
2023-04-04 22:47:45 +03:00
Ilija Tovilo
3528ca8930
Add note for GH-10168 to UPGRADING.INTERNALS 2023-04-04 18:58:01 +02:00
Dmitry Stogov
e1c6fb76c0
JIT support for delayed destructor for zend_assign_to_typed_ref/prop 2023-04-04 18:55:47 +02:00
Ilija Tovilo
fdbea4f39e
Add GC_DTOR/GC_DTOR_NO_REF macros 2023-04-04 18:55:47 +02:00
Dmitry Stogov
24acb4f134
Delay destructor for zend_std_write_property 2023-04-04 18:55:47 +02:00
Ilija Tovilo
b39107c774
Delay destructor for zend_assign_to_typed_ref 2023-04-04 18:55:47 +02:00
Ilija Tovilo
f43fa59171
Add various tests for GH-10168 2023-04-04 18:55:47 +02:00
Dmitry Stogov
915b2837f7
Delay freeing of overwritten values in assignments
Fixes GH-10168
2023-04-04 18:55:46 +02:00
Joan Miquel
9e8614233c
Add ngx-php to opcache supported sapis (#11013)
This SAPI embed PHP in Nginx server.
https://github.com/rryqszq4/ngx-php

And in the Techempower benchmarks, it's the fastest PHP SAPI.
https://www.techempower.com/benchmarks/#section=data-r20
2023-04-04 16:58:59 +02:00
Tony Su
bf123da562
[Zend]: Fix unnecessary alignment in ZEND_CALL_FRAME_SLOT macro (#10988)
Alignment is not necessary while calculating slots reserved for
zend_execute_data and _zend_vm_stack.

ZEND_STATIC_ASSERT ensures the correct alignment while code
compilation. Credit is to Ilija Tovilo.

PR: https://github.com/php/php-src/pull/10988

Signed-off-by: Tony Su <tao.su@intel.com>
Reviewed-by  : Ilija Tovilo
Reviewed-by  : Dmitry Stogov
Reviewed-by  : Niels Dossche
2023-04-04 12:09:38 +02:00
Niels Dossche
44b1619370
Cleanup pubkey checks in ext/phar (#11009)
These checks are always true because we bail out early if pubkey is
NULL or empty.
But by having these checks, it makes the code more confusing because it
implies pubkey can be false, while it can in fact not.
2023-04-04 10:04:59 +02:00
Máté Kocsis
f42992f580
Remove name field from the zend_constant struct (#10954)
As global constant names are case-sensitive now, we don't have to store them separately above the constant table.
2023-04-03 22:13:47 +02:00
Máté Kocsis
0a169cbd5b
Add forgotten upgrading note for the Readonly amendments RFC 2023-04-03 22:07:36 +02:00
Niels Dossche
fb5e77b636 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix incorrect error handling in dom_zvals_to_fragment()
2023-04-03 21:32:23 +02:00
Niels Dossche
94a00e9ecd Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect error handling in dom_zvals_to_fragment()
2023-04-03 21:24:58 +02:00
Niels Dossche
0579beb842 Fix incorrect error handling in dom_zvals_to_fragment()
Discovered this pre-existing problem while testing GH-10682.
Note: this problem existed *before* that PR.

* Not all paths throw a hierarchy request error
* xmlFreeNode must be used instead of xmlFree for the fragment to also
  free its children.
* Free up nodes that couldn't be added when xmlAddChild fails.

I unified the error handling code that's exactly the same with a goto to
prevent at least some of such problems in the future.

Closes GH-10981.
2023-04-03 21:21:35 +02:00
Ilija Tovilo
ce47e59467
Merge branch 'PHP-8.2'
* PHP-8.2:
  [skip ci] Notify Slack on nightly failure
2023-04-03 17:22:27 +02:00
Ilija Tovilo
aeb32bb357
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  [skip ci] Notify Slack on nightly failure
2023-04-03 17:21:34 +02:00
Ilija Tovilo
3a21a87443
[skip ci] Notify Slack on nightly failure 2023-04-03 17:21:12 +02:00
Dmitry Stogov
9a8123142e Merge branch 'PHP-8.2'
* PHP-8.2:
  Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference
2023-04-03 18:15:59 +03:00
Dmitry Stogov
962aac698e Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference
2023-04-03 18:15:46 +03:00
Dmitry Stogov
8a749c79d0 Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference 2023-04-03 18:15:41 +03:00
Ilija Tovilo
fc88f155be
Add zend_alloc XLEAK support
In the future we may want to use a different exit code to warn for tests that
didn't leak.

Closes GH-10999
2023-04-03 12:55:26 +02:00
Ilija Tovilo
8360efde8d
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix add_function_array() assertion when op2 contains op1
2023-04-03 12:49:43 +02:00
Ilija Tovilo
c4f56c5099
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix add_function_array() assertion when op2 contains op1
2023-04-03 12:49:33 +02:00
Ilija Tovilo
84b4020eb4
Fix add_function_array() assertion when op2 contains op1
Fixes GH-10085
Closes GH-10975
Co-authored-by: Dmitry Stogov <dmitry@zend.com>
2023-04-03 12:48:46 +02:00
Ilija Tovilo
50f58c8923
Add ASAN XLEAK support
Only disable LSAN instead of skipping the test. This way we can still detect
memory issues which is arguably more important anyway.

Closes GH-10996
2023-04-03 08:02:19 +02:00
Alex Dowad
c211e67b4e Remove XFAIL from test cases for mb_strcut when used with JIS or ISO-2022-JP encoding
The documentation for mb_strcut states:

    mb_strcut(
        string $string,
        int $start,
        ?int $length = null,
        ?string $encoding = null
    ): string

    mb_strcut() extracts a substring from a string similarly to mb_substr(),
    but operates on bytes instead of characters. If the cut position happens
    to be between two bytes of a multi-byte character, the cut is performed
    starting from the first byte of that character.

My understanding of the $length parameter for mb_strcut is that it
specified the range of bytes to extract from $string, and that all
characters encoded by those bytes should be included in the returned
string, even if that means the returned string would be longer than
$length bytes. This can happen either if 1) there is more than one way
to encode the same character in $encoding, and one way requires more
bytes than the other, or 2) $encoding uses escape sequences.

However, discussion with users of mb_strcut indicates that many of them
interpret $length as the maximum length of the *returned* string.
This is also the historical behavior of the function.

Hence, there is no need to modify the behavior of mb_strcut and then
remove XFAIL from these test cases afterwards. We can keep the current
behavior.
2023-04-02 13:52:14 +02:00
Niels Dossche
3ab6e76ed8 Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix GH-10983: State-dependant segfault in ReflectionObject::getProperties
  Fix GH-10990: mail() throws TypeError after iterating over $additional_headers array by reference
  Fix GH-8841: php-cli core dump calling a badly formed function
2023-04-01 20:23:57 +02:00
Niels Dossche
dd29b66dfa Fix GH-10983: State-dependant segfault in ReflectionObject::getProperties
This is a variant of GH-10200, but in a different place.
Basically, simplexml may create a properties table that's packed instead
of associative. But the macro that was used to loop over the properties
table assumed that it was always associative. Replace it by the macro
that figures it out automatically which one of the two it is.

For test: Co-authored-by: jnvsor

Closes GH-10984.
2023-04-01 20:19:14 +02:00
Niels Dossche
0d12b3db64 Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix GH-10990: mail() throws TypeError after iterating over $additional_headers array by reference
  Fix GH-8841: php-cli core dump calling a badly formed function
2023-04-01 20:04:48 +02:00
Niels Dossche
79c5b32d15 Fix GH-10990: mail() throws TypeError after iterating over $additional_headers array by reference
We should dereference the values, otherwise references don't work.

Closes GH-10991.
2023-04-01 19:44:43 +02:00
Niels Dossche
cf9b030a57 Fix GH-8841: php-cli core dump calling a badly formed function
It's actually not php-cli specific, nor SAPI specific.
We should delay the registration of the function into the function table
until after the compilation was successful, otherwise the function is
mistakingly registered and a NULL dereference will happen when trying to
call it.

I based my test of Nikita's test, so credits to him for the test:
https://github.com/php/php-src/pull/8933#issuecomment-1259881008

Closes GH-10989.
2023-04-01 19:43:09 +02:00
Ilija Tovilo
ed0b773cb9
[skip ci] Avoid infinite loop in differ
TBH I don't understand why this can happen here but not in sebastian/diff. I'll
have to take a closer look.
2023-04-01 15:44:46 +02:00
Ilija Tovilo
fced34ee1d
Merge branch 'PHP-8.2'
* PHP-8.2:
  Fix incorrect zval type_flags in preg_replace_callback_array() for immutable arrays
2023-03-31 14:42:44 +02:00
Ilija Tovilo
d1fc88c726
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Fix incorrect zval type_flags in preg_replace_callback_array() for immutable arrays
2023-03-31 14:42:35 +02:00
Ilija Tovilo
66ce205718
Fix incorrect zval type_flags in preg_replace_callback_array() for immutable arrays
The ZVAL_ARR macro always set the zval type_info to IS_ARRAY_EX, even if the
hash table is immutable. Since in preg_replace_callback_array() we can return
the passed array directly, and that passed array can be immutable, we need to
reset the type_flags to keep the VM from performing ref-counting on the array.

Fixes GH-10968
Closes GH-10970
2023-03-31 14:41:41 +02:00
Ilija Tovilo
ba33bbe260
Merge branch 'PHP-8.2'
* PHP-8.2:
  Unary minus const expression consistency
2023-03-31 14:28:39 +02:00
Ilija Tovilo
ed80a7e8c9
Merge branch 'PHP-8.1' into PHP-8.2
* PHP-8.1:
  Unary minus const expression consistency
2023-03-31 14:28:25 +02:00
Ilija Tovilo
41bbb116dd
Unary minus const expression consistency
- of 0.0 should result in -0.0

Closes GH-10978
2023-03-31 14:27:54 +02:00
Pierrick Charron
7359a45459
Merge branch 'PHP-8.2'
* PHP-8.2:
  [skip ci] Fix PHP 8.2.5 release date in NEWS
2023-03-30 23:30:47 -04:00