mirror of
https://github.com/php/php-src.git
synced 2026-04-17 13:01:02 +02:00
Merge branch 'PHP-7.3'
* PHP-7.3: Fixed bug #76713 (Segmentation fault caused by property corruption)
This commit is contained in:
@@ -4113,6 +4113,9 @@ static inline zval *array_column_fetch_prop(zval *data, zval *name, zval *rv) /*
|
||||
prop = Z_OBJ_HANDLER_P(data, read_property)(data, name, BP_VAR_R, NULL, rv);
|
||||
if (prop) {
|
||||
ZVAL_DEREF(prop);
|
||||
if (prop != rv) {
|
||||
Z_TRY_ADDREF_P(prop);
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (Z_TYPE_P(data) == IS_ARRAY) {
|
||||
|
||||
39
ext/standard/tests/array/bug76713.phpt
Normal file
39
ext/standard/tests/array/bug76713.phpt
Normal file
@@ -0,0 +1,39 @@
|
||||
--TEST--
|
||||
Bug #76713 (Segmentation fault caused by property corruption)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
function test($obj) {
|
||||
return array_column(array($obj), "prop");
|
||||
}
|
||||
|
||||
$obj = new Stdclass();
|
||||
|
||||
$obj->prop = str_pad("a", 10, 'a');
|
||||
|
||||
test($obj);
|
||||
test($obj);
|
||||
test($obj);
|
||||
|
||||
var_dump($obj->prop);
|
||||
|
||||
class C {
|
||||
public $name;
|
||||
public function __get($name) {
|
||||
return $this->name;
|
||||
}
|
||||
}
|
||||
|
||||
$obj = new C;
|
||||
|
||||
$obj->name = str_pad("b", 10, 'b');
|
||||
|
||||
test($obj);
|
||||
test($obj);
|
||||
test($obj);
|
||||
|
||||
var_dump($obj->prop);
|
||||
?>
|
||||
--EXPECT--
|
||||
string(10) "aaaaaaaaaa"
|
||||
string(10) "bbbbbbbbbb"
|
||||
Reference in New Issue
Block a user