Bug #65845 [PATCH]: Error when Zend Opcache Optimizer is fully enabled
| From: | laruence@php.net | Date: | Thu, 10 Oct 2013 04:29:40 +0000 |
| Subject: | Bug #65845 [PATCH]: Error when Zend Opcache Optimizer is fully enabled | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-182110@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=65845&edit=1
ID: 65845
Patch added by: laruence@php.net
Reported by: bruno+php at ahennezel dot info
Summary: Error when Zend Opcache Optimizer is fully enabled
Status: Feedback
Type: Bug
Package: opcache
Operating System: Linux 3.11.2-1-ARCH
PHP Version: 5.5.4
Assigned To: dmitry
Block user comment: N
Private report: N
New Comment:
The following patch has been added/updated:
Patch Name: bug65845.patch
Revision: 1381379379
URL: https://bugs.php.net/patch-display.php?bug=65845&patch=bug65845.patch&revision=1381379379
Previous Comments:
------------------------------------------------------------------------
[2013-10-09 16:08:02] laruence@php.net
more simple reproduce script:
<?php
function table_valeur($table) {
return $table['toto'];
}
$Pile['vars'][(string)'toto'] = 'tutu';
var_dump(table_valeur($Pile['vars']));
------------------------------------------------------------------------
[2013-10-09 16:06:42] laruence@php.net
I have got a fix:
$ git diff
diff --git a/ext/opcache/Optimizer/pass1_5.c b/ext/opcache/Optimizer/pass1_5.c
index 795b954..9ef7d8a 100644
--- a/ext/opcache/Optimizer/pass1_5.c
+++ b/ext/opcache/Optimizer/pass1_5.c
@@ -157,8 +157,8 @@ if (ZEND_OPTIMIZER_PASS_1 & OPTIMIZATION_LEVEL) {
if (ZEND_OP1_TYPE(opline) == IS_CONST &&
opline->extended_value != IS_ARRAY &&
opline->extended_value != IS_OBJECT &&
- opline->extended_value != IS_RESOURCE) {
- /* cast of constant operand */
+ opline->extended_value != IS_RESOURCE &&
+ Z_TYPE(ZEND_OP1_LITERAL(opline)) != opline->extended_value) {
zval res;
res = ZEND_OP1_LITERAL(opline);
zval_copy_ctor(&res);
to Dmitry: this is because precalculted hash is lost while doing a nop cast...
could you please review it?
------------------------------------------------------------------------
[2013-10-09 16:05:14] laruence@php.net
sorry, I used wrong branch of opcache. and now I can reproduce that.
------------------------------------------------------------------------
[2013-10-09 12:02:21] guy dot cesaro at gmail dot com
Using the right flag to enable opcache with php-cli, the output is also incorrect. I tried with php
5.5.3, 5.5.4 and the latest snapshot.
thank you for your help Cedric
------------------------------------------------------------------------
[2013-10-09 11:42:10] cedric at yterium dot com
@laruence
what makes sense is to use the right flag for cli runtime : opcache.enable is for non-cli PHP
whereas opcache.enable_cli is for cli version.
Just try with the good option in order to see the bug :
$ php55 -d opcache.enable_cli=1 -d opcache.optimization_level=0xffffffff /tmp/1.php
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=65845
--
Edit this bug report at https://bugs.php.net/bug.php?id=65845&edit=1