Skip to content

Commit 5624cbb

Browse files
committed
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
2 parents 68ada76 + ec377c6 commit 5624cbb

File tree

4 files changed

+31
-4
lines changed

4 files changed

+31
-4
lines changed

ext/phar/phar_object.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3314,7 +3314,7 @@ PHP_METHOD(Phar, compressFiles)
33143314
}
33153315

33163316
if (!pharobj_cancompress(&phar_obj->archive->manifest)) {
3317-
if (flags == PHAR_FILE_COMPRESSED_GZ) {
3317+
if (flags == PHAR_ENT_COMPRESSED_GZ) {
33183318
zend_throw_exception_ex(spl_ce_BadMethodCallException, 0,
33193319
"Cannot compress all files as Gzip, some are compressed as bzip2 and cannot be decompressed");
33203320
} else {

ext/standard/string.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2196,15 +2196,15 @@ PHP_FUNCTION(substr_replace)
21962196
if (HT_IS_PACKED(repl_ht)) {
21972197
while (repl_idx < repl_ht->nNumUsed) {
21982198
tmp_repl = &repl_ht->arPacked[repl_idx];
2199-
if (repl_ht != IS_UNDEF) {
2199+
if (Z_TYPE_P(tmp_repl) != IS_UNDEF) {
22002200
break;
22012201
}
22022202
repl_idx++;
22032203
}
22042204
} else {
22052205
while (repl_idx < repl_ht->nNumUsed) {
22062206
tmp_repl = &repl_ht->arData[repl_idx].val;
2207-
if (repl_ht != IS_UNDEF) {
2207+
if (Z_TYPE_P(tmp_repl) != IS_UNDEF) {
22082208
break;
22092209
}
22102210
repl_idx++;
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
--TEST--
2+
substr_replace() function - array with unset
3+
--FILE--
4+
<?php
5+
6+
$replacement = ['A', 'C', 'B'];
7+
unset($replacement[1]);
8+
$newarr = substr_replace(['1 string', '2 string'], $replacement, 0);
9+
print_r($newarr);
10+
11+
$replacement = ['foo', 42 => 'bar', 'baz'];
12+
unset($replacement[42]);
13+
$newarr = substr_replace(['1 string', '2 string'], $replacement, 0);
14+
print_r($newarr);
15+
16+
?>
17+
--EXPECT--
18+
Array
19+
(
20+
[0] => A
21+
[1] => B
22+
)
23+
Array
24+
(
25+
[0] => foo
26+
[1] => baz
27+
)

ext/xmlwriter/php_xmlwriter.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -448,7 +448,7 @@ PHP_FUNCTION(xmlwriter_write_element)
448448
if (retval == -1) {
449449
RETURN_FALSE;
450450
}
451-
xmlTextWriterEndElement(ptr);
451+
retval = xmlTextWriterEndElement(ptr);
452452
if (retval == -1) {
453453
RETURN_FALSE;
454454
}

0 commit comments

Comments
 (0)