Edit report at https://bugs.php.net/bug.php?id=65845&edit=1
ID: 65845 Comment by: guy dot cesaro at gmail dot com 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 Block user comment: N Private report: N New Comment: Hello Laruence, I've tried with php-cli (windows and ubuntu), the output is ok. Antoher try with : Apache/2.4.6 (Ubuntu) + PHP Version 5.5.4-1+debphp.org~raring+1 and the output is not ok. Can you please try the script with http server ? Previous Comments: ------------------------------------------------------------------------ [2013-10-08 11:05:44] larue...@php.net Please try using this snapshot: http://snaps.php.net/php5.5-latest.tar.gz For Windows: http://windows.php.net/snapshots/ please try with the latest snapshot of php5.5 in git ------------------------------------------------------------------------ [2013-10-08 11:02:28] larue...@php.net hmm, I run this with opcache enable, and fully optimizer. seems the output is expected? " $ php55 -d opcache.enable=1 -d opcache.optimization_level=0xffffffff /tmp/1.php This should echo empty string: This should echo "tutu" string: tutu " ------------------------------------------------------------------------ [2013-10-08 10:44:11] brunobergot at gmail dot com Me again, here is a last test script that work without changing opcache.optimization_level : <h1>APC BUG</h1> <?php // Expected : // APC BUG // This should echo empty string: >< // This should echo "tutu" string: >tutu< function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][$zzz=(string)'toto'] = 'tutu')."<<br />"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<<br />"; ?> ------------------------------------------------------------------------ [2013-10-08 10:30:33] brunobergot at gmail dot com Hi again Laruence, We found that the problem comes form the cast in $Pile['vars'][(string)'toto']. With this news test script it works as expected : <h1>APC BUG</h1> <?php // Expected : // APC BUG // This should echo empty string: >< // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffffffef in php.ini function table_valeur($table, $cle, $defaut='') { var_dump($table); var_dump($cle); var_dump($table[$cle]); foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars']['toto'] = 'tutu')."<<br />"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<<br />"; ?> ------------------------------------------------------------------------ [2013-10-08 10:17:30] brunobergot at gmail dot com Hi Laurence, Here is a script that show the bug in action : <h1>APC BUG</h1> <?php // Expected : // APC BUG // This should echo empty string: >< // This should echo "tutu" string: >tutu< // Works as expected with opcache.optimization_level=0xffffffef in php.ini function table_valeur($table, $cle, $defaut='') { foreach (explode('/', $cle) as $k) { $table = is_string($table) ? @unserialize($table) : $table; if (is_object($table)) { $table = (($k !== "") and isset($table->$k)) ? $table->$k : $defaut; } elseif (is_array($table)) { $table = isset($table[$k]) ? $table[$k] : $defaut; } else { $table = $defaut; } } return $table; } function vide($texte){ return ""; } echo "This should echo empty string: >".vide($Pile['vars'][(string)'toto'] = 'tutu')."<<br />"; echo "This should echo \"tutu\" string: >".table_valeur($Pile['vars'],'toto')."<<br />"; ?> ------------------------------------------------------------------------ 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