Bug #80950 [Opn->Ver]: Variables become null in if statements

From: Date: Mon, 12 Apr 2021 14:04:42 +0000
Subject: Bug #80950 [Opn->Ver]: Variables become null in if statements
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-233365@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=80950&edit=1 ID: 80950 Updated by: nikic@php.net Reported by: sycxyc at yandex dot com Summary: Variables become null in if statements -Status: Open +Status: Verified Type: Bug Package: opcache Operating System: Linux PHP Version: 7.4.16 Block user comment: N Private report: N New Comment: The func info on 7.4 incorrectly specifies that curl_exec() cannot return true. This was fixed in 8.0 as the func info was removed there (and uses the correct stub information instead). Previous Comments: ------------------------------------------------------------------------ [2021-04-12 13:20:10] sycxyc at yandex dot com 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 this bug report at https://bugs.php.net/bug.php?id=80950&edit=1

« previous php.bugs (#233365) next »