Skip to content

Commit 82f9e00

Browse files
committed
Fix ReflectionClass::getConstants() stub
If `zval_update_constant_ex()` fails, an exception has already been thrown, so we clarify that in the implementation as well. Closes GH-6557.
1 parent 2e85479 commit 82f9e00

File tree

3 files changed

+3
-4
lines changed

3 files changed

+3
-4
lines changed

ext/reflection/php_reflection.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4446,8 +4446,7 @@ ZEND_METHOD(ReflectionClass, getConstants)
44464446
array_init(return_value);
44474447
ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->constants_table, key, constant) {
44484448
if (UNEXPECTED(zval_update_constant_ex(&constant->value, ce) != SUCCESS)) {
4449-
zend_array_destroy(Z_ARRVAL_P(return_value));
4450-
RETURN_NULL();
4449+
RETURN_THROWS();
44514450
}
44524451

44534452
if (Z_ACCESS_FLAGS(constant->value) & filter) {

ext/reflection/php_reflection.stub.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ public function getProperties(?int $filter = null) {}
259259
/** @return bool */
260260
public function hasConstant(string $name) {}
261261

262-
/** @return array|null */
262+
/** @return array */
263263
public function getConstants(?int $filter = null) {}
264264

265265
/** @return ReflectionClassConstant[] */

ext/reflection/php_reflection_arginfo.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/* This is a generated file, edit the .stub.php file instead.
2-
* Stub hash: ec7607b8087ddd4297bf51cc4072465d2a0f27af */
2+
* Stub hash: 6849bff1f2b343df4bd7e6da9c8adc555731e2d3 */
33

44
ZEND_BEGIN_ARG_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 0, 1)
55
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)

0 commit comments

Comments
 (0)