Bug #77867 [Fbk->NoF]: PHP silently kills itself when referencing an invalid array key in a constant

From: Date: Sun, 28 Apr 2019 04:22:04 +0000
Subject: Bug #77867 [Fbk->NoF]: PHP silently kills itself when referencing an invalid array key in a constant
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-220630@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=77867&edit=1 ID: 77867 Updated by: php-bugs@lists.php.net Reported by: mcpe4life62 at gmail dot com Summary: PHP silently kills itself when referencing an invalid array key in a constant -Status: Feedback +Status: No Feedback Type: Bug Package: *General Issues Operating System: Windows 10 PHP Version: 7.2.17 Assigned To: cmb Private report: N New Comment: No feedback was provided. The bug is being suspended because we assume that you are no longer experiencing the problem. If this is not the case and you are able to provide the information that was requested earlier, please do so and change the status of the bug back to "Re-Opened". Thank you. Previous Comments: ------------------------------------------------------------------------ [2019-04-18 07:25:10] cmb@php.net Thank you for this bug report. To properly diagnose the problem, we need a backtrace to see what is happening behind the scenes. To find out how to generate a backtrace, please read http://bugs.php.net/bugs-generating-backtrace.php for *NIX and http://bugs.php.net/bugs-generating-backtrace-win32.php for Win32 Once you have generated a backtrace, please submit it to this bug report and change the status back to "Open". Thank you for helping us make PHP better. ------------------------------------------------------------------------ [2019-04-09 07:55:52] nikic@php.net I can't reproduce this on Linux: https://3v4l.org/Mnk96 I also checked that it works with opcache loaded and that no valgrind warnings are triggered. ------------------------------------------------------------------------ [2019-04-09 07:45:55] mcpe4life62 at gmail dot com Description: ------------ Adding a class / interface constant that references to another constant via an array key that's non-existent kills the PHP process silently. (without invoking die() or exit()) There are no error messages thrown, nor a warning, or anything. PHP just dies. There are two different results on two different scenarios. If this bug was done on an interface, PHP silently kills itself, as mentioned for several times. If this bug was done on a class, PHP Freezes silently and refuses to do anything. I've only tested this for a few minutes, I don't know if it un-freezes and exits after a while. Due to no error messages are being displayed, this made debugging it a bit tricky at first. It took me quite a few minutes before finding out that it was an invalid array key access. Even while I'm using PHPStorm (the class constant 'ARRAY_1' is an empty array), the erroneous code does not get pointed out or highlighted. Test script: --------------- // Only use one of these to get different results. // Insta-kill interface BrokenInterface { // this can be anything... even null. just with a non-existent key public const ARRAY_1 = []; public const ARRAY_2 = [ self::ARRAY_1["nonExistentKey"] ]; } class UseThisClass implements BrokenInterface {} (new UseThisClass()); // Freeze class BrokenClass { // this can be anything... even null. just with a non-existent key public const ARRAY_1 = []; public const ARRAY_2 = [ self::ARRAY_1["nonExistentKey"] ]; } (new BrokenClass()); Expected result: ---------------- A Compile Error should be thrown. Actual result: -------------- PHP Silently shuts down without any warning or error message. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=77867&edit=1

« previous php.bugs (#220630) next »