Bug #80950 [NEW]: Variables become null in if statements

From: Date: Mon, 12 Apr 2021 13:20:10 +0000
Subject: Bug #80950 [NEW]: Variables become null in if statements
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233364@lists.php.net to get a copy of this message
From: sycxyc at yandex dot com Operating system: Linux PHP version: 7.4.16 Package: opcache Bug Type: Bug Bug description:Variables become null in if statements Description: ------------ When opcache is enabled, unexpected results will occur when executed twice or more. Test script: --------------- <?php function foo(){ $ch=curl_init('example.com'); curl_setopt($ch,CURLOPT_RETURNTRANSFER,false); ob_start(); $data=curl_exec($ch); ob_end_clean(); var_dump('out1',$data); if(true===$data){ if(null===$data){ var_dump('in1',$data); } } var_dump('out2',$data); } foo(); Expected result: ---------------- string(4) "out1" bool(true) string(4) "out2" bool(true) Actual result: -------------- string(4) "out1" bool(true) string(3) "in1" NULL string(4) "out2" bool(true) -- Edit bug report at https://bugs.php.net/bug.php?id=80950&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=80950&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=80950&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=80950&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=80950&r=needscript Try newer version: https://bugs.php.net/fix.php?id=80950&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=80950&r=support Expected behavior: https://bugs.php.net/fix.php?id=80950&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=80950&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=80950&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=80950&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=80950&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=80950&r=dst IIS Stability: https://bugs.php.net/fix.php?id=80950&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=80950&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=80950&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=80950&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=80950&r=mysqlcfg

« previous php.bugs (#233364) next »