summaryrefslogtreecommitdiff
path: root/Zend/tests/bug69889.phpt
blob: 8aae7c16f7e5e71eb26ace962d19ee6c07645e4c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
--TEST--
Bug #69889: Null coalesce operator doesn't work for string offsets
--FILE--
<?php

$foo = "test";
var_dump($foo[0] ?? "default");

var_dump($foo[5] ?? "default");
var_dump(isset($foo[5]) ? $foo[5] : "default");

var_dump($foo["str"] ?? "default");
var_dump(isset($foo["str"]) ? $foo["str"] : "default");

?>
--EXPECT--
string(1) "t"
string(7) "default"
string(7) "default"
string(7) "default"
string(7) "default"