Bug #78810 [Opn->Csd]: RW fetches do not throw "uninitialized property" exception

From: Date: Fri, 15 Nov 2019 11:09:33 +0000
Subject: Bug #78810 [Opn->Csd]: RW fetches do not throw "uninitialized property" exception
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-223727@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=78810&edit=1 ID: 78810 Updated by: nikic@php.net Reported by: nikic@php.net Summary: RW fetches do not throw "uninitialized property" exception -Status: Open +Status: Closed Type: Bug Package: Scripting Engine problem PHP Version: 7.4.0RC5 Block user comment: N Private report: N New Comment: Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=266f3a02bce4e4c68f93744540c9bfd32516c868 Log: Fixed bug #78810 Previous Comments: ------------------------------------------------------------------------ [2019-11-13 19:56:44] nikic@php.net Description: ------------ Accesses to uninitialized typed properties currently only throw an exception for R fetches, but not increments (https://3v4l.org/PPkFu) or compound assignment operators (https://3v4l.org/eHkLs). These should throw as well. Salvaged from bug #78809, which had to be deleted due to inappropriate language. Test script: --------------- <?php class Test { public int $i; } $test = new Test; $test->i++; Expected result: ---------------- Uncaught Error: Typed property Test::$i must not be accessed before initialization Actual result: -------------- Notice: Undefined property: Test::$i in /in/oqvf3 on line 7 ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=78810&edit=1

« previous php.bugs (#223727) next »