Skip to content
forked from php/php-src

sync #21

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1,430 commits into from
May 5, 2023
Merged

sync #21

merged 1,430 commits into from
May 5, 2023

Conversation

chopins
Copy link
Owner

@chopins chopins commented May 5, 2023

No description provided.

nielsdos and others added 30 commits March 30, 2023 20:56
* PHP-8.2:
  Fix bug #80602: Segfault when using DOMChildNode::before()
* PHP-8.1:
  [ci skip] NEWS
* PHP-8.2:
  Handle indirect zvals and use up-to-date properties in SplFixedArray::__serialize
  [ci skip] NEWS
This very sharp edge should have been documented long ago.
* PHP-8.2:
  [skip ci] Fix PHP 8.2.5 release date in NEWS
- of 0.0 should result in -0.0

Closes GH-10978
* PHP-8.1:
  Unary minus const expression consistency
* PHP-8.2:
  Unary minus const expression consistency
…mutable 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
* PHP-8.1:
  Fix incorrect zval type_flags in preg_replace_callback_array() for immutable arrays
* PHP-8.2:
  Fix incorrect zval type_flags in preg_replace_callback_array() for immutable arrays
TBH I don't understand why this can happen here but not in sebastian/diff. I'll
have to take a closer look.
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:
#8933 (comment)

Closes GH-10989.
…l_headers array by reference

We should dereference the values, otherwise references don't work.

Closes GH-10991.
* 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
…ties

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.
* 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
…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.
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
* PHP-8.1:
  Fix add_function_array() assertion when op2 contains op1
* PHP-8.2:
  Fix add_function_array() assertion when op2 contains op1
In the future we may want to use a different exit code to warn for tests that
didn't leak.

Closes GH-10999
* PHP-8.1:
  Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference
* PHP-8.2:
  Tracing JIT: Fixed incorrect code generation fofr SEND-ing of result of ASSIGN to typed reference
ColinHDev and others added 29 commits May 2, 2023 12:05
Changed the value of nNextFreeElement in _zend_empty_array from 0 to
ZEND_LONG_MIN.

Fixes GH-11154
Closes GH-11157
Max length of a single trace. A long trace generates long JITTed
code, which influences the performance slightly.
opcache.jit_max_trace_length range is [4,1024], the default value
is 1024.


Reviewed-by:   Su, Tao   <[email protected]>

Signed-off-by: Wang, Xue <[email protected]>
* Fixed GH-11127 (JIT fault)

* Added test

* Add new line
* PHP-8.1:
  Fixed GH-11127 (JIT fault)
* PHP-8.2:
  Fixed GH-11127 (JIT fault)
There is a typo which causes the AND and OR range inference to infer a
wider range than necessary. Fix this typo. There are many ranges for
which the inference is too wide, I just picked one for AND and one for
OR that I found through symbolic execution.

In this example test, the previous range inferred for test_or was [-27..-1]
instead of [-20..-1].
And the previous range inferred for test_and was [-32..-25]
instead of [-28..-25].

Closes GH-11170.
* PHP-8.1:
  Fix too wide OR and AND range inference
* PHP-8.2:
  Fix too wide OR and AND range inference
Co-authored-by: KapitanOczywisty

Closes GH-11155
We have lots of spurious failures in CI, many of them with the "all" CONFLICT.
We're limiting the retrying to specific error messages. In the future we may
also provide a FLAKY section to retry specific tests.

Closes GH-10892
* PHP-8.1:
  Add retry mechanism in run-tests.php
* PHP-8.2:
  Add retry mechanism in run-tests.php
This patch preserves the scratch registers of the SysV x86-64 ABI by storing
them to the stack and restoring them later. We need to do this to prevent the
registers of the caller from being corrupted. The reason these get corrupted
is because the compiler is unaware of the Valgrind replacement function and
thus makes assumptions about the original function regarding registers which
are not true for the replacement function.

For implementation I used a GCC and Clang attribute. A more general
approach would be to use inline assembly but that's also less portable
and quite hacky. This attributes is supported since GCC 7.x, but the
target option is only supported since 11.x. For Clang the target option
does not matter.

Closes GH-10221.
A negative value like -1 may overflow and cause incorrect results in the
timeout variable, which causes an immediate timeout. As this is caused
by undefined behaviour the exact behaviour depends on the compiler, its
version, and the platform.

A large overflow is also possible, if an extremely large timeout value
is passed we also set an indefinite timeout. This is because the timeout
value is at least a 64-bit number and waiting for UINT64_MAX/1000000
seconds is waiting about 584K years.

Closes GH-11183.
…P 8.1.18)

Dynamic property case in zend_get_property_info() can return NULL for
prop info. This was not handled.

Closes GH-11182.
* PHP-8.1:
  Fix GH-11178: Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18)
  Fix GH-11175 and GH-11177: Stream socket timeout undefined behaviour
  Fix GH-9068: Conditional jump or move depends on uninitialised value(s)
* PHP-8.2:
  Fix GH-11178: Segmentation fault in spl_array_it_get_current_data (PHP 8.1.18)
  Fix GH-11175 and GH-11177: Stream socket timeout undefined behaviour
  Fix GH-9068: Conditional jump or move depends on uninitialised value(s)
…script

I found no reason why this is done this way.
Of course this will allow users to do stupid stuff like
`fclose(STDOUT);` etc. but if they type in that code they clearly know
what they're doing...

Close GH-11169.
…ppercasing strings (#11161)

Since lowercasing and uppercasing is a common operation for both
internal purposes and userland purposes, it makes sense to implement a
NEON accelerated version for this.
Removing (obsolete) PGrequestCancel usage in favor of the thread-safe
 PQcancel/PQfreeCancel pair.

Close GH-11081
…e array in an invalid state

There are more places in zend_hash.c where the resize happened after some values on the HashTable struct were set.
I reordered them all, but writing a test for these would rely on the particular amount of bytes allocated at given points in time.
- PGSQL_TRACE_SUPPRESS_TIMESTAMPS.
- PGSQL_TRACE_REGRESS_MODE to have a more verbose and observable
output to check possible regressions.

Close GH-11041
@chopins chopins merged commit 86402dc into chopins:master May 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.