mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
Merge branch 'PHP-8.0' into PHP-8.1
* PHP-8.0: Fix GH-8080: ReflectionClass::getConstants() depends on def. order
This commit is contained in:
commit
27d2fddf6a
3 changed files with 37 additions and 2 deletions
4
NEWS
4
NEWS
|
@ -28,6 +28,10 @@ PHP NEWS
|
|||
- MySQLnd:
|
||||
. Fixed bug GH-8058 (NULL pointer dereference in mysqlnd package). (Kamil Tekiela)
|
||||
|
||||
- Reflection:
|
||||
. Fixed bug GH-8080 (ReflectionClass::getConstants() depends on def. order).
|
||||
(cmb)
|
||||
|
||||
- Zlib:
|
||||
. Fixed bug GH-7953 (ob_clean() only does not set Content-Encoding). (cmb)
|
||||
|
||||
|
|
|
@ -4637,7 +4637,7 @@ ZEND_METHOD(ReflectionClass, getConstants)
|
|||
|
||||
array_init(return_value);
|
||||
ZEND_HASH_FOREACH_STR_KEY_PTR(CE_CONSTANTS_TABLE(ce), key, constant) {
|
||||
if (UNEXPECTED(zval_update_constant_ex(&constant->value, ce) != SUCCESS)) {
|
||||
if (UNEXPECTED(zval_update_constant_ex(&constant->value, constant->ce) != SUCCESS)) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
|
||||
|
@ -4696,7 +4696,7 @@ ZEND_METHOD(ReflectionClass, getConstant)
|
|||
GET_REFLECTION_OBJECT_PTR(ce);
|
||||
constants_table = CE_CONSTANTS_TABLE(ce);
|
||||
ZEND_HASH_FOREACH_PTR(constants_table, c) {
|
||||
if (UNEXPECTED(zval_update_constant_ex(&c->value, ce) != SUCCESS)) {
|
||||
if (UNEXPECTED(zval_update_constant_ex(&c->value, c->ce) != SUCCESS)) {
|
||||
RETURN_THROWS();
|
||||
}
|
||||
} ZEND_HASH_FOREACH_END();
|
||||
|
|
31
ext/reflection/tests/gh8080.phpt
Normal file
31
ext/reflection/tests/gh8080.phpt
Normal file
|
@ -0,0 +1,31 @@
|
|||
--TEST--
|
||||
GH-8080 (ReflectionClass::getConstants() depends on def. order)
|
||||
--FILE--
|
||||
<?php
|
||||
class A {
|
||||
const LIST = [
|
||||
self::TEST => 'Test',
|
||||
];
|
||||
private const TEST = 'test';
|
||||
}
|
||||
|
||||
class B extends A {}
|
||||
|
||||
$r = new ReflectionClass(B::class);
|
||||
var_dump(
|
||||
$r->getConstants(),
|
||||
$r->getConstant("LIST")
|
||||
);
|
||||
?>
|
||||
--EXPECT--
|
||||
array(1) {
|
||||
["LIST"]=>
|
||||
array(1) {
|
||||
["test"]=>
|
||||
string(4) "Test"
|
||||
}
|
||||
}
|
||||
array(1) {
|
||||
["test"]=>
|
||||
string(4) "Test"
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue