Bug #66251 [NEW]: Constants get statically bound at compile time when Optimized

From: Date: Tue, 10 Dec 2013 01:48:43 +0000
Subject: Bug #66251 [NEW]: Constants get statically bound at compile time when Optimized
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-183210@lists.php.net to get a copy of this message
From: Terry at ellisons dot org dot uk Operating system: N/A PHP version: master-Git-2013-12-09 (Git) Package: opcache Bug Type: Bug Bug description:Constants get statically bound at compile time when Optimized Description: ------------ The B/C behaviour is to bind constants at execution of the DEFINE_CONSTANT opcode. The 5.6 optimizer now attempts to evaluate them at compile time, which changes the execution behaviour. Test script: --------------- --TEST-- Terry_001 Constants get statically bound at compile time when Optimized --INI-- opcache.enable=1 opcache.enable_cli=1 opcache.optimization_level=-1 --SKIPIF-- <?php if (!extension_loaded('Zend OPcache') || php_sapi_name() != "cli") die("skip CLI only"); ?> --FILE-- <?php printf ("A=%s\n", getA()); const A="hello"; function getA() {return A;} --CLEAN-- --EXPECTF-- Notice: Use of undefined constant A - assumed 'A' in %son line %d A=A -- Edit bug report at https://bugs.php.net/bug.php?id=66251&edit=1 -- Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66251&r=trysnapshot54 Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66251&r=trysnapshot55 Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66251&r=trysnapshottrunk Fixed in SVN: https://bugs.php.net/fix.php?id=66251&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=66251&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=66251&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=66251&r=needscript Try newer version: https://bugs.php.net/fix.php?id=66251&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=66251&r=support Expected behavior: https://bugs.php.net/fix.php?id=66251&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=66251&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=66251&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=66251&r=globals PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66251&r=php4 Daylight Savings: https://bugs.php.net/fix.php?id=66251&r=dst IIS Stability: https://bugs.php.net/fix.php?id=66251&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=66251&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=66251&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=66251&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=66251&r=mysqlcfg

« previous php.bugs (#183210) next »