Bug #66524 [Fbk->NoF]: Short-hand ternary operator broken for variables (on LiteSpeed server)
Edit report at https://bugs.php.net/bug.php?id=66524&edit=1
ID: 66524
Updated by: php-bugs@lists.php.net
Reported by: ante dot vrli at gmail dot com
Summary: Short-hand ternary operator broken for variables (on
LiteSpeed server)
-Status: Feedback
+Status: No Feedback
Type: Bug
Package: Variables related
Operating System: Linux 2.6.32
PHP Version: 5.4.24
Private report: N
New Comment:
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.
Previous Comments:
------------------------------------------------------------------------
[2016-03-26 23:15:41] nikic@php.net
Switching to Feedback, that's probably what was intended there. In the unlikely case that this
issue still exists in recent versions of PHP, please reopen the bug.
------------------------------------------------------------------------
[2014-01-21 18:23:27] rasmus@php.net
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.
------------------------------------------------------------------------
[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
Thread (4 messages)