1
0
mirror of https://github.com/php/php-src.git synced 2026-03-24 00:02:20 +01:00

Merge branch 'PHP-8.4'

* PHP-8.4:
  Fix assertion failure in zend_std_read_property
This commit is contained in:
Arnaud Le Blanc
2024-10-30 12:02:59 +01:00
3 changed files with 48 additions and 1 deletions

View File

@@ -0,0 +1,23 @@
--TEST--
GH-16615 001 (Assertion failure in zend_std_read_property)
--FILE--
<?php
class Foo {
public string $bar {
set => $value;
}
}
$reflector = new ReflectionClass(Foo::class);
// Adds IS_PROP_LAZY to prop flags
$foo = $reflector->newLazyGhost(function ($ghost) {
$ghost->bar = 'bar';
});
echo $foo->bar;
?>
--EXPECT--
bar

View File

@@ -0,0 +1,24 @@
--TEST--
GH-16615 002 (Assertion failure in zend_std_read_property)
--FILE--
<?php
class Foo {
public string $bar {
set => $value;
}
public function __clone() {
try {
echo $this->bar;
} catch (Error $e) {
printf("%s: %s\n", $e::class, $e->getMessage());
}
}
}
// Adds IS_PROP_REINITABLE to prop flags
clone new Foo();
?>
--EXPECT--
Error: Typed property Foo::$bar must not be accessed before initialization

View File

@@ -791,7 +791,7 @@ try_again:
if (UNEXPECTED(Z_TYPE_P(retval) == IS_UNDEF)) {
/* As hooked properties can't be unset, the only way to end up with an undef
* value is via an uninitialized property. */
ZEND_ASSERT(Z_PROP_FLAG_P(retval) == IS_PROP_UNINIT);
ZEND_ASSERT(Z_PROP_FLAG_P(retval) & IS_PROP_UNINIT);
goto uninit_error;
}