Bug #73919 [NEW]: Short tertiary operator and pointer
| From: | p17 at ivaldi dot xyz | Date: | Thu, 12 Jan 2017 12:54:33 +0000 |
| Subject: | Bug #73919 [NEW]: Short tertiary operator and pointer | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-206554@lists.php.net to get a copy of this message | ||
From: p17 at ivaldi dot xyz
Operating system: Linux 4.8.0-2-amd64
PHP version: 7.1.0
Package: *General Issues
Bug Type: Bug
Bug description:Short tertiary operator and pointer
Description:
------------
Using the short tertiary operator ?: with a pointer as first condition
results in a non expected result.
Test script:
---------------
#!/usr/bin/php
<?php
error_reporting(E_ALL | E_STRICT);
$val = &$foo ?: 'default';
var_dump($val);
Expected result:
----------------
string(7) "default"
Actual result:
--------------
NULL
--
Edit bug report at https://bugs.php.net/bug.php?id=73919&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=73919&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=73919&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=73919&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=73919&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=73919&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=73919&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=73919&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=73919&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=73919&r=support
Expected behavior: https://bugs.php.net/fix.php?id=73919&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=73919&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=73919&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=73919&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=73919&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=73919&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=73919&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=73919&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=73919&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=73919&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=73919&r=mysqlcfg