|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2020-08-31 09:51 UTC] nikic@php.net
[2020-08-31 10:14 UTC] nikic@php.net
-Assigned To:
+Assigned To: nikic
[2020-08-31 10:19 UTC] nikic@php.net
[2020-08-31 10:19 UTC] nikic@php.net
-Status: Assigned
+Status: Closed
[2020-08-31 10:25 UTC] miloslav dot hula at gmail dot com
|
|||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Fri Nov 21 13:00:01 2025 UTC |
Description: ------------ Test script leads to fatal error when magic method __get() is declared and assign by reference. Test script: --------------- <?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; # try to remove & } return $me; } public function __get($name) { throw new \LogicException("Property '$name' is not defined."); } } A::fromArray(['a' => 'foo']); Expected result: ---------------- (no error) Actual result: -------------- Fatal error: Uncaught Error: Typed property A::$a must not be accessed before initialization.