Bug #66251 [Opn]: Constants get statically bound at compile time when Optimized
| From: | laruence@php.net | Date: | Tue, 10 Dec 2013 09:11:32 +0000 |
| Subject: | Bug #66251 [Opn]: Constants get statically bound at compile time when Optimized | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-183215@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66251&edit=1
ID: 66251
Updated by: laruence@php.net
Reported by: Terry at ellisons dot org dot uk
Summary: Constants get statically bound at compile time when
Optimized
Status: Open
Type: Bug
Package: opcache
Operating System: N/A
PHP Version: master-Git-2013-12-09 (Git)
-Assigned To:
+Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
the previous is a wrong usage... so I think the current opt is okey...
thanks
Previous Comments:
------------------------------------------------------------------------
[2013-12-10 01:48:42] Terry at ellisons dot org dot uk
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 this bug report at https://bugs.php.net/bug.php?id=66251&edit=1