Skip to content

Commit cf3317c

Browse files
committed
Merge branch 'PHP-7.3'
2 parents 61b0122 + 00e5d0e commit cf3317c

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed
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)