Bug #73919 [Opn->Ver]: Short ternary operator and reference
| From: | cmb@php.net | Date: | Thu, 12 Jan 2017 13:13:02 +0000 |
| Subject: | Bug #73919 [Opn->Ver]: Short ternary operator and reference | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-206557@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=73919&edit=1
ID: 73919
Updated by: cmb@php.net
Reported by: p17 at ivaldi dot xyz
-Summary: Short tertiary operator and pointer
+Summary: Short ternary operator and reference
-Status: Open
+Status: Verified
Type: Bug
-Package: *General Issues
+Package: Scripting Engine problem
Operating System: Linux 4.8.0-2-amd64
PHP Version: 7.1.0
Block user comment: N
Private report: N
New Comment:
Confirmed: <https://3v4l.org/IU2Cq#v560>.
Previous Comments:
------------------------------------------------------------------------
[2017-01-12 12:54:29] p17 at ivaldi dot xyz
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 this bug report at https://bugs.php.net/bug.php?id=73919&edit=1