Bug #66524 [NEW]: Short-hand ternary operator broken for variables (on LiteSpeed server)
| From: | ante dot vrli at gmail dot com | Date: | Mon, 20 Jan 2014 18:13:19 +0000 |
| Subject: | Bug #66524 [NEW]: Short-hand ternary operator broken for variables (on LiteSpeed server) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-183924@lists.php.net to get a copy of this message | ||
From: ante dot vrli at gmail dot com
Operating system: Linux 2.6.32
PHP version: 5.4.24
Package: Variables related
Bug Type: Bug
Bug description:Short-hand ternary operator broken for variables (on LiteSpeed server)
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 bug report at https://bugs.php.net/bug.php?id=66524&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=66524&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=66524&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=66524&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=66524&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=66524&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=66524&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=66524&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=66524&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=66524&r=support
Expected behavior: https://bugs.php.net/fix.php?id=66524&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=66524&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=66524&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=66524&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=66524&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=66524&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=66524&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=66524&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=66524&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=66524&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=66524&r=mysqlcfg