xref: /PHP-8.0/Zend/tests/bug43344_1.phpt (revision d30cd7d7)
1--TEST--
2Bug #43344.1 (Wrong error message for undefined namespace constant)
3--FILE--
4<?php
5namespace Foo;
6use Error;
7
8function f1($a=bar) {
9    return $a;
10}
11function f2($a=array(bar)) {
12    return $a[0];
13}
14function f3($a=array(bar=>0)) {
15    reset($a);
16    return key($a);
17}
18
19try {
20    echo bar."\n";
21} catch (Error $e) {
22    echo $e->getMessage(), "\n";
23}
24try {
25    echo f1()."\n";
26} catch (Error $e) {
27    echo $e->getMessage(), "\n";
28}
29try {
30    echo f2()."\n";
31} catch (Error $e) {
32    echo $e->getMessage(), "\n";
33}
34try {
35    echo f3()."\n";
36} catch (Error $e) {
37    echo $e->getMessage(), "\n";
38}
39
40?>
41--EXPECT--
42Undefined constant "Foo\bar"
43Undefined constant "Foo\bar"
44Undefined constant "Foo\bar"
45Undefined constant "Foo\bar"
46