Skip to content

Commit 00e5d0e

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents ade702a + 5d33024 commit 00e5d0e

File tree

3 files changed

+18
-0
lines changed

3 files changed

+18
-0
lines changed

NEWS

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,8 @@ PHP NEWS
6161

6262
- Standard:
6363
. Fixed bug #77395 (segfault about array_multisort). (Laruence)
64+
. Fixed bug #77439 (parse_str segfaults when inserting item into existing
65+
array). (Nikita)
6466

6567
10 Jan 2019, PHP 7.3.1
6668

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
--TEST--
2+
Bug #77439: parse_str segfaults when inserting item into existing array
3+
--FILE--
4+
<?php
5+
$a = [];
6+
parse_str('a[1]=1');
7+
var_dump($a);
8+
?>
9+
--EXPECTF--
10+
Deprecated: parse_str(): Calling parse_str() without the result argument is deprecated in %s on line %d
11+
array(1) {
12+
[1]=>
13+
string(1) "1"
14+
}

main/php_variables.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,6 +224,8 @@ PHPAPI void php_register_variable_ex(char *var_name, zval *val, zval *track_vars
224224
if (Z_TYPE_P(gpc_element_p) != IS_ARRAY) {
225225
zval_ptr_dtor_nogc(gpc_element_p);
226226
array_init(gpc_element_p);
227+
} else {
228+
SEPARATE_ARRAY(gpc_element_p);
227229
}
228230
}
229231
}

0 commit comments

Comments
 (0)