php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #78271 Invalid result of if-else
Submitted: 2019-07-10 13:51 UTC Modified: 2019-07-10 14:58 UTC
From: marekc at softel dot com dot pl Assigned:
Status: Closed Package: opcache
PHP Version: 7.3.7 OS: Linux Debian 8.11 64bit
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: marekc at softel dot com dot pl
New email:
PHP Version: OS:

 

 [2019-07-10 13:51 UTC] marekc at softel dot com dot pl
Description:
------------
The test script should print "block1" but on 7.3.7 prints "none1". Also tested on 7.2 and 7.1, it's "block1" there.

Test script:
---------------
<?
function test($a, $b){

if($a==10){$w="x";}else{$w="y";}

if($b){$d1="none";$d2="block";}else{$d1="block";$d2="none";}

echo $d2.$b;

}

test(1,1);
?>




Expected result:
----------------
block1

Actual result:
--------------
none1

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-07-10 13:54 UTC] nikic@php.net
-Status: Open +Status: Verified -Package: *Programming Data Structures +Package: opcache
 [2019-07-10 13:54 UTC] nikic@php.net
Confirming under opcache.
 [2019-07-10 13:55 UTC] sjon@php.net
Are you sure? Works fine here; https://3v4l.org/3RYph

what additional modules do you have enabled?
 [2019-07-10 14:18 UTC] marekc at softel dot com dot pl
List of modules below. I can confirm that after disabling opcache the result is "block1"

[PHP Modules]
bcmath
bz2
calendar
Core
ctype
curl
date
dba
dom
exif
fileinfo
filter
ftp
gd
gettext
gmp
hash
iconv
imagick
json
libxml
mbstring
mysqli
mysqlnd
openssl
pcre
PDO
pdo_mysql
Phar
posix
Reflection
session
SimpleXML
soap
sockets
SPL
standard
tokenizer
xml
xmlreader
xmlrpc
xmlwriter
xsl
Zend OPcache
zip
zlib

[Zend Modules]
Zend OPcache
 [2019-07-10 14:58 UTC] nikic@php.net
Looks like yet another smart branch fail:

L0 (2):     CV0($a) = RECV 1
L1 (2):     CV1($b) = RECV 2
L2 (3):     T3 = IS_EQUAL CV0($a) int(10)
L3 (9):     JMPZ CV1($b) L6

There should be a NOP after the IS_EQUAL.
 [2019-07-10 15:29 UTC] nikic@php.net
Automatic comment on behalf of nikita.ppv@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=e7a83ec8dff962ea624508f18b9b10f5add030cc
Log: Fix bug #78271
 [2019-07-10 15:29 UTC] nikic@php.net
-Status: Verified +Status: Closed
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Oct 27 16:01:27 2024 UTC