]> granicus.if.org Git - php/commitdiff
Fix ReflectionClass::getConstants() stub
authorChristoph M. Becker <cmbecker69@gmx.de>
Thu, 31 Dec 2020 18:36:27 +0000 (19:36 +0100)
committerChristoph M. Becker <cmbecker69@gmx.de>
Fri, 1 Jan 2021 13:46:28 +0000 (14:46 +0100)
If `zval_update_constant_ex()` fails, an exception has already been
thrown, so we clarify that in the implementation as well.

Closes GH-6557.

ext/reflection/php_reflection.c
ext/reflection/php_reflection.stub.php
ext/reflection/php_reflection_arginfo.h

index dfa084caa5853964609e83dd5792ac88fcdafdbf..a782a3ef0fae954aec08caa76ae7fac9752f8a3e 100644 (file)
@@ -4446,8 +4446,7 @@ ZEND_METHOD(ReflectionClass, getConstants)
        array_init(return_value);
        ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, constant) {
                if (UNEXPECTED(zval_update_constant_ex(&constant->value, ce) != SUCCESS)) {
-                       zend_array_destroy(Z_ARRVAL_P(return_value));
-                       RETURN_NULL();
+                       RETURN_THROWS();
                }
 
                if (Z_ACCESS_FLAGS(constant->value) & filter) {
index 7e2f061142bc34af3dba1b9dc0d03ab49cee732d..d12d10bd81d3907c63d07dc925cf1be0b86e3201 100644 (file)
@@ -259,7 +259,7 @@ class ReflectionClass implements Reflector
     /** @return bool */
     public function hasConstant(string $name) {}
 
-    /** @return array|null */
+    /** @return array */
     public function getConstants(?int $filter = null) {}
 
     /** @return ReflectionClassConstant[] */
index 591a160ed3150e83accad9546aeab26153c07737..ba524b4f6d24206732826a8aef7829f0e063be9b 100644 (file)
@@ -1,5 +1,5 @@
 /* This is a generated file, edit the .stub.php file instead.
- * Stub hash: ec7607b8087ddd4297bf51cc4072465d2a0f27af */
+ * Stub hash: 6849bff1f2b343df4bd7e6da9c8adc555731e2d3 */
 
 ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 0, 1)
        ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)