Bug #66524 [Opn->Ana]: Short-hand ternary operator broken for variables (on LiteSpeed server)
| From: | rasmus@php.net | Date: | Tue, 21 Jan 2014 18:23:27 +0000 |
| Subject: | Bug #66524 [Opn->Ana]: Short-hand ternary operator broken for variables (on LiteSpeed server) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-183941@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=66524&edit=1
ID: 66524
Updated by: rasmus@php.net
Reported by: ante dot vrli at gmail dot com
Summary: Short-hand ternary operator broken for variables (on
LiteSpeed server)
-Status: Open
+Status: Analyzed
Type: Bug
Package: Variables related
Operating System: Linux 2.6.32
PHP Version: 5.4.24
Block user comment: N
Private report: N
New Comment:
This seems extremely unlikely to me. The SAPI PHP is running under should have absolutely no effect
on the parsing barring some really weird memory corruption in Litespeed. Throw Valgrind at it and
see if that is the case but first triple-check that you are seeing what you think you are seeing.
Previous Comments:
------------------------------------------------------------------------
[2014-01-20 18:13:18] ante dot vrli at gmail dot com
Description:
------------
In short-hand ternary comparison, variables are always evaluated as false.
This bug was found in PHP versions 5.4.23 and 5.4.24, when running as a module on LiteSpeed server,
as compiled using EasyApache, but NOT when running in CLI. So it has to do with LiteSpeed, it seems,
but nevertheless the issue somehow compiles into a core PHP issue.
Configure command:
'./configure' '--disable-fileinfo' '--enable-bcmath'
'--enable-calendar' '--enable-exif' '--enable-ftp'
'--enable-gd-native-ttf' '--enable-libxml' '--enable-mbstring'
'--enable-pdo=shared' '--enable-soap' '--enable-sockets'
'--enable-wddx' '--enable-zip' '--prefix=/usr/local'
'--with-bz2' '--with-curl=/opt/curlssl/' '--with-curlwrappers'
'--with-freetype-dir=/usr' '--with-gd' '--with-gettext'
'--with-imap=/opt/php_with_imap_client/' '--with-imap-ssl=/usr'
'--with-jpeg-dir=/usr' '--with-kerberos' '--with-libdir=lib64'
'--with-libexpat-dir=/usr' '--with-libxml-dir=/opt/xml2'
'--with-libxml-dir=/opt/xml2/' '--with-mcrypt=/opt/libmcrypt/'
'--with-mm=/opt/mm/' '--with-mysql=/usr'
'--with-mysql-sock=/var/lib/mysql/mysql.sock'
'--with-mysqli=/usr/bin/mysql_config' '--with-openssl=/usr'
'--with-openssl-dir=/usr' '--with-pcre-regex=/opt/pcre'
'--with-pdo-mysql=shared' '--with-pdo-sqlite=shared' '--with-pic'
'--with-png-dir=/usr' '--with-pspell' '--with-tidy=/opt/tidy/'
'--with-xmlrpc!
' '--with-xpm-dir=/usr' '--with-xsl=/opt/xslt/' '--with-zlib'
'--with-zlib-dir=/usr' '--with-litespeed'
Test script:
---------------
$v = 'Correct';
echo ($v ? $v: 'Incorrect'); // Echoes "Correct"
echo ($v ?: 'Incorrect'); // Echoes "Incorrect"
Expected result:
----------------
"Correct Correct"
Actual result:
--------------
"Correct Incorrect"
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=66524&edit=1