1
0
mirror of https://github.com/php/php-src.git synced 2026-03-26 09:12:14 +01:00
Files
archived-php-src/Zend/tests/nullsafe_operator/031.phpt
Nikita Popov f491dabe40 Fix nullsafe operator on reference
Dereference the value before checking the type. As the happy path
necessarily has to check for references, I'm not bothering to
delay the comparison.
2020-08-11 15:11:36 +02:00

19 lines
244 B
PHP

--TEST--
Nullsafe operator on referenced value
--FILE--
<?php
$val = null;
$ref =& $val;
var_dump($ref?->foo);
$val = new stdClass;
var_dump($ref?->foo);
?>
--EXPECTF--
NULL
Warning: Undefined property: stdClass::$foo in %s on line %d
NULL