mirror of
https://github.com/php/php-src.git
synced 2024-12-25 01:40:50 +08:00
aad39879f2
Access to undefined constants will now always result in an Error exception being thrown. This required quite a few test changes, because there were many buggy tests that unintentionally used bareword fallback in combination with error suppression.
46 lines
723 B
PHP
46 lines
723 B
PHP
--TEST--
|
|
Bug #43344.1 (Wrong error message for undefined namespace constant)
|
|
--FILE--
|
|
<?php
|
|
namespace Foo;
|
|
use Error;
|
|
|
|
function f1($a=bar) {
|
|
return $a;
|
|
}
|
|
function f2($a=array(bar)) {
|
|
return $a[0];
|
|
}
|
|
function f3($a=array(bar=>0)) {
|
|
reset($a);
|
|
return key($a);
|
|
}
|
|
|
|
try {
|
|
echo bar."\n";
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
try {
|
|
echo f1()."\n";
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
try {
|
|
echo f2()."\n";
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
try {
|
|
echo f3()."\n";
|
|
} catch (Error $e) {
|
|
echo $e->getMessage(), "\n";
|
|
}
|
|
|
|
?>
|
|
--EXPECT--
|
|
Undefined constant 'Foo\bar'
|
|
Undefined constant 'Foo\bar'
|
|
Undefined constant 'Foo\bar'
|
|
Undefined constant 'Foo\bar'
|