Merge branch 'PHP-7.4'

* PHP-7.4:
  Add test for bug #80039
This commit is contained in:
Nikita Popov 2020-08-31 11:22:51 +02:00
commit 0e9d76ee62

43
Zend/tests/bug80039.phpt Normal file
View File

@ -0,0 +1,43 @@
--TEST--
Bug #80039: Illegal string offset and Cannot create references to/from string offsets
--FILE--
<?php
final class A
{
public string $a;
public static function fromArray(array $props): self
{
$me = new static;
foreach ($props as $k => &$v) {
$me->{$k} = &$v;
}
return $me;
}
public function __get($name)
{
throw new \LogicException("Property '$name' is not defined.");
}
}
class ObjectHelpers
{
public static function hasProperty(string $class, string $name)
{
static $cache = [];
$prop = &$cache[$class][$name]; # <-- emits error
var_dump($prop);
}
}
set_exception_handler(function ($e) {
ObjectHelpers::hasProperty(A::class, 'a');
});
A::fromArray(['a' => 'foo']);
?>
--EXPECT--
NULL