Edit report at https://bugs.php.net/bug.php?id=65845&edit=1
ID: 65845 Updated by: larue...@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: more simple reproduce script: <?php function table_valeur($table) { return $table['toto']; } $Pile['vars'][(string)'toto'] = 'tutu'; var_dump(table_valeur($Pile['vars'])); Previous Comments: ------------------------------------------------------------------------ [2013-10-09 16:06:42] larue...@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] larue...@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 ------------------------------------------------------------------------ [2013-10-09 09:07:28] brunobergot at gmail dot com Hi Laruence, i'm pretty sure that Guy use the same php script cause i've sended it to him ;) ------------------------------------------------------------------------ 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