Merge branch 'PHP-8.1' into PHP-8.2

* PHP-8.1:
  Fix wrong flags check for compression method in phar_object.c
  Fix missing check for xmlTextWriterEndElement
  Fix substr_replace with slots in repl_ht being UNDEF
This commit is contained in:
George Peter Banyard 2023-01-15 15:43:34 +00:00
commit ec377c687d
No known key found for this signature in database
GPG key ID: 3306078E3194AEBD
5 changed files with 38 additions and 4 deletions

7
NEWS
View file

@ -31,6 +31,9 @@ PHP NEWS
. Fix zend_jit_find_trace() crashes. (Max Kellermann) . Fix zend_jit_find_trace() crashes. (Max Kellermann)
. Added missing lock for EXIT_INVALIDATE in zend_jit_trace_exit. (Max Kellermann) . Added missing lock for EXIT_INVALIDATE in zend_jit_trace_exit. (Max Kellermann)
- Phar:
. Fix wrong flags check for compression method in phar_object.c (nielsdos)
- PHPDBG: - PHPDBG:
. Fix undefined behaviour in phpdbg_load_module_or_extension(). (nielsdos) . Fix undefined behaviour in phpdbg_load_module_or_extension(). (nielsdos)
. Fix NULL pointer dereference in phpdbg_create_conditional_breal(). (nielsdos) . Fix NULL pointer dereference in phpdbg_create_conditional_breal(). (nielsdos)
@ -46,6 +49,10 @@ PHP NEWS
. Fix GH-10187 (Segfault in stripslashes() with arm64). (nielsdos) . Fix GH-10187 (Segfault in stripslashes() with arm64). (nielsdos)
. Fixed bug GH-10214 (Incomplete validation of object syntax during . Fixed bug GH-10214 (Incomplete validation of object syntax during
unserialize()). (timwolla) unserialize()). (timwolla)
. Fix substr_replace with slots in repl_ht being UNDEF. (nielsdos)
- XMLWriter
. Fix missing check for xmlTextWriterEndElement (nielsdos)
05 Jan 2023, PHP 8.2.1 05 Jan 2023, PHP 8.2.1

View file

@ -3314,7 +3314,7 @@ PHP_METHOD(Phar, compressFiles)
} }
if (!pharobj_cancompress(&phar_obj->archive->manifest)) { if (!pharobj_cancompress(&phar_obj->archive->manifest)) {
if (flags == PHAR_FILE_COMPRESSED_GZ) { if (flags == PHAR_ENT_COMPRESSED_GZ) {
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
"Cannot compress all files as Gzip, some are compressed as bzip2 and cannot be decompressed"); "Cannot compress all files as Gzip, some are compressed as bzip2 and cannot be decompressed");
} else { } else {

View file

@ -2365,7 +2365,7 @@ PHP_FUNCTION(substr_replace)
if (HT_IS_PACKED(repl_ht)) { if (HT_IS_PACKED(repl_ht)) {
while (repl_idx < repl_ht->nNumUsed) { while (repl_idx < repl_ht->nNumUsed) {
tmp_repl = &repl_ht->arPacked[repl_idx]; tmp_repl = &repl_ht->arPacked[repl_idx];
if (repl_ht != IS_UNDEF) { if (Z_TYPE_P(tmp_repl) != IS_UNDEF) {
break; break;
} }
repl_idx++; repl_idx++;
@ -2373,7 +2373,7 @@ PHP_FUNCTION(substr_replace)
} else { } else {
while (repl_idx < repl_ht->nNumUsed) { while (repl_idx < repl_ht->nNumUsed) {
tmp_repl = &repl_ht->arData[repl_idx].val; tmp_repl = &repl_ht->arData[repl_idx].val;
if (repl_ht != IS_UNDEF) { if (Z_TYPE_P(tmp_repl) != IS_UNDEF) {
break; break;
} }
repl_idx++; repl_idx++;

View file

@ -0,0 +1,27 @@
--TEST--
substr_replace() function - array with unset
--FILE--
<?php
$replacement = ['A', 'C', 'B'];
unset($replacement[1]);
$newarr = substr_replace(['1 string', '2 string'], $replacement, 0);
print_r($newarr);
$replacement = ['foo', 42 => 'bar', 'baz'];
unset($replacement[42]);
$newarr = substr_replace(['1 string', '2 string'], $replacement, 0);
print_r($newarr);
?>
--EXPECT--
Array
(
[0] => A
[1] => B
)
Array
(
[0] => foo
[1] => baz
)

View file

@ -449,7 +449,7 @@ PHP_FUNCTION(xmlwriter_write_element)
if (retval == -1) { if (retval == -1) {
RETURN_FALSE; RETURN_FALSE;
} }
xmlTextWriterEndElement(ptr); retval = xmlTextWriterEndElement(ptr);
if (retval == -1) { if (retval == -1) {
RETURN_FALSE; RETURN_FALSE;
} }