#45320 [NEW]: Ternary-Operator Shortcut and empty()

From: Date: Fri, 20 Jun 2008 08:12:27 +0000
Subject: #45320 [NEW]: Ternary-Operator Shortcut and empty()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-125910@lists.php.net to get a copy of this message
From: reto at buxaprojects dot com Operating system: PHP version: 6CVS-2008-06-20 (snap) PHP Bug Type: Scripting Engine problem Bug description: Ternary-Operator Shortcut and empty() Description: ------------ The Ternary-Operator shortcut doesn't do the same with empty() Reproduce code: --------------- ini_set('display_errors', true); error_reporting(E_ALL|E_STRICT); $var = 'Something'; echo !empty($var) ? $var : 'Nothing'; echo !empty($var) ?: 'Nothing'; Expected result: ---------------- SomethingSomething Actual result: -------------- Something1 -- Edit bug report at http://bugs.php.net/?id=45320&edit=1 -- Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=45320&r=trysnapshot52 Try a CVS snapshot (PHP 5.3): http://bugs.php.net/fix.php?id=45320&r=trysnapshot53 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=45320&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=45320&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=45320&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=45320&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=45320&r=needscript Try newer version: http://bugs.php.net/fix.php?id=45320&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=45320&r=support Expected behavior: http://bugs.php.net/fix.php?id=45320&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=45320&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=45320&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=45320&r=globals PHP 4 support discontinued: http://bugs.php.net/fix.php?id=45320&r=php4 Daylight Savings: http://bugs.php.net/fix.php?id=45320&r=dst IIS Stability: http://bugs.php.net/fix.php?id=45320&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=45320&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=45320&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=45320&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=45320&r=mysqlcfg

« previous php.bugs (#125910) next »