mirror of
https://github.com/php/php-src.git
synced 2025-08-16 14:08:47 +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:
commit
48d5100738
2 changed files with 23 additions and 1 deletions
22
Zend/tests/closure_write_prop.phpt
Normal file
22
Zend/tests/closure_write_prop.phpt
Normal 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
|
|
@ -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);
|
||||
}
|
||||
/* }}} */
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue