Bug #68765 [NEW]: Commands with @ must not be evaluated by opcache
| From: | axel dot ml at warenform dot net | Date: | Wed, 07 Jan 2015 12:01:13 +0000 |
| Subject: | Bug #68765 [NEW]: Commands with @ must not be evaluated by opcache | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-189699@lists.php.net to get a copy of this message | ||
From: axel dot ml at warenform dot net
Operating system: Linux x86_64
PHP version: 5.6.4
Package: opcache
Bug Type: Bug
Bug description:Commands with @ must not be evaluated by opcache
Description:
------------
With active opcache following problems occurs:
If constants.php is called first the output is:
1
1
1
1
1
which is correct.
If constants-include.php is called the output is:
4
which is also correct.
If constants.php is called afterwards the output is:
1
1
1
4
1
which is wrong.
The line is @define('SOME_CONSTANT', 4) is conditionally because of the
"@" and must not be evaluated by opcache but on runtime.
If the line is rewritten as:
if (!defined('SOME_CONSTANT')) define('SOME_CONSTANT', 4);
everything works as expected.
Thank you for fixing this issue.
Test script:
---------------
FILE: constants-include.php
@define('SOME_CONSTANT', 4);
echo SOME_CONSTANT.'<br>'.PHP_EOL;
FILE: constants.php
define('SOME_CONSTANT', 1);
echo SOME_CONSTANT.'<br>'.PHP_EOL;
@define('SOME_CONSTANT', 2);
echo SOME_CONSTANT.'<br>'.PHP_EOL;
@define('SOME_CONSTANT', 3);
echo SOME_CONSTANT.'<br>'.PHP_EOL;
include('./constants-include.php');
echo SOME_CONSTANT.'<br>'.PHP_EOL;
Expected result:
----------------
1
1
1
1
1
Actual result:
--------------
1
1
1
4
1
--
Edit bug report at https://bugs.php.net/bug.php?id=68765&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=68765&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=68765&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=68765&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=68765&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=68765&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=68765&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=68765&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=68765&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=68765&r=support
Expected behavior: https://bugs.php.net/fix.php?id=68765&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=68765&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=68765&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=68765&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=68765&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=68765&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=68765&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=68765&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=68765&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=68765&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=68765&r=mysqlcfg