Mantis - Quercus
Viewing Issue Advanced Details
2934 block always 09-14-08 11:26 09-15-08 16:25
koreth  
ferg  
normal  
closed 3.2.1  
fixed  
none    
none 3.2.1  
0002934: Modified local array variable value lost when leaving "try" block in compiled mode
<?php
function doit() {
  $foo = null;
  try {
    $foo = array('x' => array());
    $foo['x'][] = 1;
  }
  catch (Exception $e) { }

  if ($foo === null) {
    print "uh oh";
  } else {
    print "whew";
  }
}

doit();


This prints "whew" (the expected result since the array should never be null) in interpreted mode, but "uh oh" in compiled mode. If you put a print_r($foo) at the end of the try block, you see the expected output in both compiled and interpreted modes, but the value is discarded when the try block exits in compiled mode.

Notes
(0003442)
ferg   
09-15-08 16:25   
php/3g11