mirror of
https://github.com/php/php-src.git
synced 2024-09-21 18:07:23 +00:00
- Fixed bug #51791 (constant() aborts execution when fail to check undefined constant)
This commit is contained in:
parent
ec93c50c3f
commit
bcd9a87e2a
14
Zend/tests/bug51791.phpt
Normal file
14
Zend/tests/bug51791.phpt
Normal file
@ -0,0 +1,14 @@
|
||||
--TEST--
|
||||
Bug #51791 (constant() failed to check undefined constant and php interpreter stoped)
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
class A {
|
||||
const B = 1;
|
||||
}
|
||||
var_dump(constant('A::B1'));
|
||||
|
||||
?>
|
||||
--EXPECTF--
|
||||
Warning: constant(): Couldn't find constant A::B1 in %s on line %d
|
||||
NULL
|
@ -3771,7 +3771,7 @@ PHP_FUNCTION(constant)
|
||||
return;
|
||||
}
|
||||
|
||||
if (!zend_get_constant_ex(const_name, const_name_len, return_value, NULL, 0 TSRMLS_CC)) {
|
||||
if (!zend_get_constant_ex(const_name, const_name_len, return_value, NULL, ZEND_FETCH_CLASS_SILENT TSRMLS_CC)) {
|
||||
php_error_docref(NULL TSRMLS_CC, E_WARNING, "Couldn't find constant %s", const_name);
|
||||
RETURN_NULL();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user