- Core:
. Fixed bug #77589 (Core dump using parse_ini_string with numeric sections).
(Laruence)
+ . Fixed bug #75546 (function "defined" should ignore class constant
+ visibility). (Daniel Ciochiu)
- Exif:
. Fixed bug #77564 (Memory leak in exif_process_IFD_TAG). (Ben Ramsey)
ret_constant = NULL;
} else {
if (!zend_verify_const_access(c, scope)) {
- zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
+ if ((flags & ZEND_FETCH_CLASS_SILENT) == 0) {
+ zend_throw_error(NULL, "Cannot access %s const %s::%s", zend_visibility_string(Z_ACCESS_FLAGS(c->value)), ZSTR_VAL(class_name), ZSTR_VAL(constant_name));
+ }
goto failure;
}
ret_constant = &c->value;
private const C1 = "a";
}
-try {
- var_dump(constant('Foo::C1'));
-} catch (Error $e) {
- var_dump($e->getMessage());
-}
---EXPECT--
-string(35) "Cannot access private const Foo::C1"
+var_dump(constant('Foo::C1'));
+--EXPECTF--
+Warning: constant(): Couldn't find constant Foo::C1 in %s on line %d
+NULL
string(14) "protectedConst"
string(14) "protectedConst"
-Fatal error: Uncaught Error: Cannot access protected const A::protectedConst in %s:14
-Stack trace:
-#0 %s(14): constant('A::protectedCon...')
-#1 {main}
- thrown in %s on line 14
+Warning: constant(): Couldn't find constant A::protectedConst in %s on line %d
string(12) "privateConst"
string(12) "privateConst"
-Fatal error: Uncaught Error: Cannot access private const A::privateConst in %s:14
-Stack trace:
-#0 %s(14): constant('A::privateConst')
-#1 {main}
- thrown in %s on line 14
+Warning: constant(): Couldn't find constant A::privateConst in %s on line %d
--- /dev/null
+--TEST--
+Defined on private constant should not raise exception
+--FILE--
+<?php
+
+class Foo
+{
+ private const BAR = 1;
+}
+echo (int)defined('Foo::BAR');
+--EXPECTF--
+0