1
0
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:
Xinchen Hui
2018-08-07 12:36:48 +08:00
2 changed files with 42 additions and 0 deletions

View File

@@ -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) {

View 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"