zendtech / ZendOptimizerPlus

Other
914 stars 142 forks source link

Switch statement error with pre-defined constants #198

Open timwhitlock opened 9 years ago

timwhitlock commented 9 years ago

This odd switch error seems to affect the testing of pre-defined constants when the statement has multiple cases to one break.

switch( PHP_VERSION ) {
case 'anything':
case '5.4.36': 
    break;
default:
    echo PHP_VERSION,"\n"; // <- prints "5.4.36"
}

In the above version of PHP using OPcache version 7.0.3FE The value doesn't seem to move on from the first failed case, so the second equality is not evaluated. The error doesn't occur with user-defined constants or variables.

I can post my opcache ini settings if it helps.

dstogov commented 9 years ago

I can't reproduce this.

Thanks. Dmitry.

On Fri, Dec 26, 2014 at 5:04 PM, Tim Whitlock notifications@github.com wrote:

This odd switch error seems to affect the testing of pre-defined constants when the statement has multiple cases to one break.

switch( PHP_VERSION ) {case 'anything':case '5.4.36': break;default: echo PHP_VERSION,"\n"; // <- prints "5.4.36"}

In the above version of PHP using OPcache version 7.0.3FE The value doesn't seem to fall through from the first break, so the second equality is not evaluated. The error doesn't occur with user-defined constants or variables.

I can post my opcache ini settings if it helps.

— Reply to this email directly or view it on GitHub https://github.com/zendtech/ZendOptimizerPlus/issues/198.

timwhitlock commented 9 years ago

Appears to only affect Mac OS X, including Linux VMs running on Mac. Also seems that 7.0.2 is unaffected.

laruence commented 9 years ago

I remembered I fixed a similar bug before, could you please try with 7.0.5 again?