mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
Merge branch 'PHP-8.2'
* PHP-8.2: 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:
commit
5624cbbed1
@ -3314,7 +3314,7 @@ PHP_METHOD(Phar, compressFiles)
|
||||
}
|
||||
|
||||
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,
|
||||
"Cannot compress all files as Gzip, some are compressed as bzip2 and cannot be decompressed");
|
||||
} else {
|
||||
|
@ -2196,7 +2196,7 @@ PHP_FUNCTION(substr_replace)
|
||||
if (HT_IS_PACKED(repl_ht)) {
|
||||
while (repl_idx < repl_ht->nNumUsed) {
|
||||
tmp_repl = &repl_ht->arPacked[repl_idx];
|
||||
if (repl_ht != IS_UNDEF) {
|
||||
if (Z_TYPE_P(tmp_repl) != IS_UNDEF) {
|
||||
break;
|
||||
}
|
||||
repl_idx++;
|
||||
@ -2204,7 +2204,7 @@ PHP_FUNCTION(substr_replace)
|
||||
} else {
|
||||
while (repl_idx < repl_ht->nNumUsed) {
|
||||
tmp_repl = &repl_ht->arData[repl_idx].val;
|
||||
if (repl_ht != IS_UNDEF) {
|
||||
if (Z_TYPE_P(tmp_repl) != IS_UNDEF) {
|
||||
break;
|
||||
}
|
||||
repl_idx++;
|
||||
|
27
ext/standard/tests/strings/substr_replace_array_unset.phpt
Normal file
27
ext/standard/tests/strings/substr_replace_array_unset.phpt
Normal 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
|
||||
)
|
@ -448,7 +448,7 @@ PHP_FUNCTION(xmlwriter_write_element)
|
||||
if (retval == -1) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
xmlTextWriterEndElement(ptr);
|
||||
retval = xmlTextWriterEndElement(ptr);
|
||||
if (retval == -1) {
|
||||
RETURN_FALSE;
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user