1
0
mirror of https://github.com/php/php-src.git synced 2026-04-15 20:11:02 +02:00

Merge branch 'PHP-7.4'

* PHP-7.4:
  Fix use-after-free when trying to write to closure property
This commit is contained in:
Nikita Popov
2019-12-18 10:24:41 +01:00
2 changed files with 23 additions and 1 deletions

View File

@@ -0,0 +1,22 @@
--TEST--
Cannot write to closure properties
--FILE--
<?php
class A {
function getFn() {
return function() {
};
}
}
$a = new A;
try {
$c = $a->getFn()->b = new stdClass;
} catch (Error $e) {
echo $e->getMessage(), "\n";
}
?>
--EXPECT--
Closure object cannot have properties

View File

@@ -433,7 +433,7 @@ static ZEND_COLD zval *zend_closure_read_property(zend_object *object, zend_stri
static ZEND_COLD zval *zend_closure_write_property(zend_object *object, zend_string *member, zval *value, void **cache_slot) /* {{{ */
{
ZEND_CLOSURE_PROPERTY_ERROR();
return value;
return &EG(error_zval);
}
/* }}} */