xref: /PHP-7.2/Zend/tests/bug69889.phpt (revision f1d7e3ca)
1--TEST--
2Bug #69889: Null coalesce operator doesn't work for string offsets
3--FILE--
4<?php
5
6$foo = "test";
7var_dump($foo[0] ?? "default");
8
9var_dump($foo[5] ?? "default");
10var_dump(isset($foo[5]) ? $foo[5] : "default");
11
12var_dump($foo["str"] ?? "default");
13var_dump(isset($foo["str"]) ? $foo["str"] : "default");
14
15?>
16--EXPECT--
17string(1) "t"
18string(7) "default"
19string(7) "default"
20string(7) "default"
21string(7) "default"
22