Bug #79160 [NEW]: String Concatenation along with condition/ternary operator yields wrong result.

From: Date: Thu, 23 Jan 2020 13:25:58 +0000
Subject: Bug #79160 [NEW]: String Concatenation along with condition/ternary operator yields wrong result.
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-225063@lists.php.net to get a copy of this message
From: divyaedward89 at gmail dot com Operating system: PHP version: 7.2.27 Package: Strings related Bug Type: Bug Bug description:String Concatenation along with condition/ternary operator yields wrong result. Description: ------------ --- From manual page: https://php.net/language.operators.string --- String Concatenation along with condition/ternary operator yields wrong result. The condition does not execute as expected. The condition affects the string concatenation. Test script: --------------- <?php $var='I am not empty'; $query = ''; $query .= 'Value of var='.(empty($var)) ? '0' : $var; echo $query; ?> Expected result: ---------------- Value of var=I am not empty -- Edit bug report at https://bugs.php.net/bug.php?id=79160&edit=1 -- Fix committed: https://bugs.php.net/fix.php?id=79160&r=fixed Fixed in release: https://bugs.php.net/fix.php?id=79160&r=alreadyfixed Need backtrace: https://bugs.php.net/fix.php?id=79160&r=needtrace Need Reproduce Script: https://bugs.php.net/fix.php?id=79160&r=needscript Try newer version: https://bugs.php.net/fix.php?id=79160&r=oldversion Not developer issue: https://bugs.php.net/fix.php?id=79160&r=support Expected behavior: https://bugs.php.net/fix.php?id=79160&r=notwrong Not enough info: https://bugs.php.net/fix.php?id=79160&r=notenoughinfo Submitted twice: https://bugs.php.net/fix.php?id=79160&r=submittedtwice register_globals: https://bugs.php.net/fix.php?id=79160&r=globals PHP version support discontinued: https://bugs.php.net/fix.php?id=79160&r=phptooold Daylight Savings: https://bugs.php.net/fix.php?id=79160&r=dst IIS Stability: https://bugs.php.net/fix.php?id=79160&r=isapi Install GNU Sed: https://bugs.php.net/fix.php?id=79160&r=gnused Floating point limitations: https://bugs.php.net/fix.php?id=79160&r=float No Zend Extensions: https://bugs.php.net/fix.php?id=79160&r=nozend MySQL Configuration Error: https://bugs.php.net/fix.php?id=79160&r=mysqlcfg

« previous php.bugs (#225063) next »