Bug #76284 [Opn->Fbk]: auto_globals_jit doesn't detect all types of superglobal use

From: Date: Sun, 29 Apr 2018 05:00:03 +0000
Subject: Bug #76284 [Opn->Fbk]: auto_globals_jit doesn't detect all types of superglobal use
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-214976@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=76284&edit=1 ID: 76284 Updated by: requinix@php.net Reported by: jocrutrisi at ibsats dot com Summary: auto_globals_jit doesn't detect all types of superglobal use -Status: Open +Status: Feedback Type: Bug -Package: PHP options/info functions +Package: Scripting Engine problem Operating System: Linux PHP Version: 7.2.5 Block user comment: N Private report: N New Comment: Thank you for this bug report. To properly diagnose the problem, we need a short but complete example script to be able to reproduce this bug ourselves. A proper reproducing script starts with <?php and ends with ?>, is max. 10-20 lines long and does not require any external resources such as databases, etc. If the script requires a database to demonstrate the issue, please make sure it creates all necessary tables, stored procedures etc. Please avoid embedding huge scripts into the report. Works for me, and that exact code you posted won't do the job anyways. The repro script has to be precise, not some summarized version of your tests. Previous Comments: ------------------------------------------------------------------------ [2018-04-28 22:38:29] jocrutrisi at ibsats dot com Description: ------------ I was unexpectedly bit by "$_ENV undefined" notice when using auto_globals_jit. Apparently PHP is very specific about what is considered a superglobal use and what isn't. See examples below. Test script: --------------- // This is considered $_ENV use. $foo = $_ENV['foo']; // This is considered $_ENV use. foreach ($_ENV as $k => $v); // BUG: This is NOT considered $_ENV use (so I get a notice here that $_ENV is undefined) $foo = $_ENV; // BUG: Another example of the same problem (I get a notice $_ENV is undefined) function foo() { return ['env' => $_ENV]; } foo(); Expected result: ---------------- I expect JIT should work transparently. Any mention of $_ENV must cause $_ENV to get defined as if it always was. The exceptions are rather odd, it's unclear why detection of use is not fully comprehensive. Actual result: -------------- Notice of undefined $_ENV. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=76284&edit=1

« previous php.bugs (#214976) next »