Mantis - Quercus
Viewing Issue Advanced Details
1731 crash always 05-11-07 08:48 05-15-07 09:20
obaltz  
nam  
normal  
closed 3.1.1  
fixed  
none    
none 3.1.2  
0001731: Quercus produces invalid Java code
Given a function performing an indefinite loop which runs until stopped by external conditions or timeout (e.g. networking stuff ). Quercus generates some "return null" stuff right after the loop. If all ways out of the loop are return (rather than break) statements, the generated "return null" is not reachable. Unreachable code leads to:

500 Servlet Exception

unreachable statement
      return com.caucho.quercus.env.NullValue.NULL;
      ^
1 error

See additional info for a demo script.
<?php

function testloop() {
    for( ; ; ) {
        if ( rand( 1, 10 ) > 5 ) {
            return 1;
        }
        return 2;
    }
}

print( testloop() );
?>

Notes
(0001915)
nam   
05-15-07 09:20   
php/3626
php/3627