[pull] master from php:master - #1264
Merged
Merged
Conversation
…emoval. Fix GH-23385 The serialization loop passed php_var_serialize() a pointer into the list element itself, so a userland __serialize() unsetting that entry freed both the element and its payload while the serializer was still walking them. Serialize a copy of the element data instead, which outlives the callback. Close GH-23388
This PR optimizes the user-visible `str_pad()` by reducing repeated small copy operations during padding. In `php_str_pad_fill()`, the algorithm now uses doubling copies to grow the written region exponentially. This lowers memcpy counts and improves throughput for large repeated-pattern padding workloads. Added `str_pad_repeated_pattern.phpt` to validate repeated pattern and partial-tail boundaries, including multi-byte patterns and all pad directions. Behavior is unchanged; this is a performance-only change and is now recorded in the PHP 8.6 performance changelog.
offset_to_pointer_utf8() walks the haystack using the UTF-8 mblen table. For a truncated multibyte sequence, the lead byte's table entry can exceed the remaining bytes and leave the search start pointer past the end. Passing that pointer to zend_memnstr() triggers an assertion in debug builds and an out-of-bounds read in release builds, producing bogus offsets or a crash for sufficiently long haystacks. Clamp the pointer to the end of the string, as mb_str_split() already does for the same table walk. Add regression coverage for forward and reverse searches, negative offsets, and offsets beyond the haystack. Fixes GH-23106. Closes #23107
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to subscribe to this conversation on GitHub.
Already have an account?
Sign in.
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
See Commits and Changes for more details.
Created by
pull[bot] (v2.0.0-alpha.4)
Can you help keep this open source service alive? 💖 Please sponsor : )