mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.4'
* PHP-8.4: Fix GH-16162: No ReflectionProperty::IS_VIRTUAL
This commit is contained in:
commit
b34f22d801
6 changed files with 66 additions and 4 deletions
|
@ -1595,6 +1595,9 @@ ZEND_METHOD(Reflection, getModifierNames)
|
||||||
if (modifiers & ZEND_ACC_FINAL) {
|
if (modifiers & ZEND_ACC_FINAL) {
|
||||||
add_next_index_stringl(return_value, "final", sizeof("final")-1);
|
add_next_index_stringl(return_value, "final", sizeof("final")-1);
|
||||||
}
|
}
|
||||||
|
if (modifiers & ZEND_ACC_VIRTUAL) {
|
||||||
|
add_next_index_stringl(return_value, "virtual", sizeof("virtual")-1);
|
||||||
|
}
|
||||||
|
|
||||||
/* These are mutually exclusive */
|
/* These are mutually exclusive */
|
||||||
switch (modifiers & ZEND_ACC_PPP_MASK) {
|
switch (modifiers & ZEND_ACC_PPP_MASK) {
|
||||||
|
|
|
@ -464,6 +464,8 @@ class ReflectionProperty implements Reflector
|
||||||
public const int IS_PROTECTED_SET = UNKNOWN;
|
public const int IS_PROTECTED_SET = UNKNOWN;
|
||||||
/** @cvalue ZEND_ACC_PRIVATE_SET */
|
/** @cvalue ZEND_ACC_PRIVATE_SET */
|
||||||
public const int IS_PRIVATE_SET = UNKNOWN;
|
public const int IS_PRIVATE_SET = UNKNOWN;
|
||||||
|
/** @cvalue ZEND_ACC_VIRTUAL */
|
||||||
|
public const int IS_VIRTUAL = UNKNOWN;
|
||||||
/** @cvalue ZEND_ACC_FINAL */
|
/** @cvalue ZEND_ACC_FINAL */
|
||||||
public const int IS_FINAL = UNKNOWN;
|
public const int IS_FINAL = UNKNOWN;
|
||||||
|
|
||||||
|
|
8
ext/reflection/php_reflection_arginfo.h
generated
8
ext/reflection/php_reflection_arginfo.h
generated
|
@ -1,5 +1,5 @@
|
||||||
/* This is a generated file, edit the .stub.php file instead.
|
/* This is a generated file, edit the .stub.php file instead.
|
||||||
* Stub hash: ad354b7dc9caadc2bb5ed810964ebf83acd27f1d */
|
* Stub hash: 1cdf310b94e2297a4e426bd4c0c1ab4d5995936d */
|
||||||
|
|
||||||
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 1, IS_ARRAY, 0)
|
ZEND_BEGIN_ARG_WITH_TENTATIVE_RETURN_TYPE_INFO_EX(arginfo_class_Reflection_getModifierNames, 0, 1, IS_ARRAY, 0)
|
||||||
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
|
ZEND_ARG_TYPE_INFO(0, modifiers, IS_LONG, 0)
|
||||||
|
@ -1605,6 +1605,12 @@ static zend_class_entry *register_class_ReflectionProperty(zend_class_entry *cla
|
||||||
zend_declare_typed_class_constant(class_entry, const_IS_PRIVATE_SET_name, &const_IS_PRIVATE_SET_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
zend_declare_typed_class_constant(class_entry, const_IS_PRIVATE_SET_name, &const_IS_PRIVATE_SET_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||||
zend_string_release(const_IS_PRIVATE_SET_name);
|
zend_string_release(const_IS_PRIVATE_SET_name);
|
||||||
|
|
||||||
|
zval const_IS_VIRTUAL_value;
|
||||||
|
ZVAL_LONG(&const_IS_VIRTUAL_value, ZEND_ACC_VIRTUAL);
|
||||||
|
zend_string *const_IS_VIRTUAL_name = zend_string_init_interned("IS_VIRTUAL", sizeof("IS_VIRTUAL") - 1, 1);
|
||||||
|
zend_declare_typed_class_constant(class_entry, const_IS_VIRTUAL_name, &const_IS_VIRTUAL_value, ZEND_ACC_PUBLIC, NULL, (zend_type) ZEND_TYPE_INIT_MASK(MAY_BE_LONG));
|
||||||
|
zend_string_release(const_IS_VIRTUAL_name);
|
||||||
|
|
||||||
zval const_IS_FINAL_value;
|
zval const_IS_FINAL_value;
|
||||||
ZVAL_LONG(&const_IS_FINAL_value, ZEND_ACC_FINAL);
|
ZVAL_LONG(&const_IS_FINAL_value, ZEND_ACC_FINAL);
|
||||||
zend_string *const_IS_FINAL_name = zend_string_init_interned("IS_FINAL", sizeof("IS_FINAL") - 1, 1);
|
zend_string *const_IS_FINAL_name = zend_string_init_interned("IS_FINAL", sizeof("IS_FINAL") - 1, 1);
|
||||||
|
|
|
@ -14,12 +14,15 @@ class C {
|
||||||
static public $pubs2;
|
static public $pubs2;
|
||||||
static private $privs1;
|
static private $privs1;
|
||||||
static private $privs2;
|
static private $privs2;
|
||||||
|
public $hookNoVirt { set { $this->hookNoVirt = strtoupper($value); } }
|
||||||
|
public $hookVirt { get { return 42; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
$rc = new ReflectionClass("C");
|
$rc = new ReflectionClass("C");
|
||||||
$StaticFlag = ReflectionProperty::IS_STATIC;
|
$StaticFlag = ReflectionProperty::IS_STATIC;
|
||||||
$pubFlag = ReflectionProperty::IS_PUBLIC;
|
$pubFlag = ReflectionProperty::IS_PUBLIC;
|
||||||
$privFlag = ReflectionProperty::IS_PRIVATE;
|
$privFlag = ReflectionProperty::IS_PRIVATE;
|
||||||
|
$virtFlag = ReflectionProperty::IS_VIRTUAL;
|
||||||
|
|
||||||
echo "No properties:";
|
echo "No properties:";
|
||||||
var_dump($rc->getProperties(0));
|
var_dump($rc->getProperties(0));
|
||||||
|
@ -35,11 +38,14 @@ var_dump($rc->getProperties($StaticFlag | $pubFlag));
|
||||||
|
|
||||||
echo "Private or static properties:";
|
echo "Private or static properties:";
|
||||||
var_dump($rc->getProperties($StaticFlag | $privFlag));
|
var_dump($rc->getProperties($StaticFlag | $privFlag));
|
||||||
|
|
||||||
|
echo "Virtual properties:";
|
||||||
|
var_dump($rc->getProperties($virtFlag));
|
||||||
?>
|
?>
|
||||||
--EXPECTF--
|
--EXPECTF--
|
||||||
No properties:array(0) {
|
No properties:array(0) {
|
||||||
}
|
}
|
||||||
Public properties:array(4) {
|
Public properties:array(6) {
|
||||||
[0]=>
|
[0]=>
|
||||||
object(ReflectionProperty)#%d (2) {
|
object(ReflectionProperty)#%d (2) {
|
||||||
["name"]=>
|
["name"]=>
|
||||||
|
@ -68,6 +74,20 @@ Public properties:array(4) {
|
||||||
["class"]=>
|
["class"]=>
|
||||||
string(1) "C"
|
string(1) "C"
|
||||||
}
|
}
|
||||||
|
[4]=>
|
||||||
|
object(ReflectionProperty)#%d (2) {
|
||||||
|
["name"]=>
|
||||||
|
string(10) "hookNoVirt"
|
||||||
|
["class"]=>
|
||||||
|
string(1) "C"
|
||||||
|
}
|
||||||
|
[5]=>
|
||||||
|
object(ReflectionProperty)#%d (2) {
|
||||||
|
["name"]=>
|
||||||
|
string(8) "hookVirt"
|
||||||
|
["class"]=>
|
||||||
|
string(1) "C"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Private properties:array(4) {
|
Private properties:array(4) {
|
||||||
[0]=>
|
[0]=>
|
||||||
|
@ -99,7 +119,7 @@ Private properties:array(4) {
|
||||||
string(1) "C"
|
string(1) "C"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Public or static properties:array(6) {
|
Public or static properties:array(8) {
|
||||||
[0]=>
|
[0]=>
|
||||||
object(ReflectionProperty)#%d (2) {
|
object(ReflectionProperty)#%d (2) {
|
||||||
["name"]=>
|
["name"]=>
|
||||||
|
@ -142,6 +162,20 @@ Public or static properties:array(6) {
|
||||||
["class"]=>
|
["class"]=>
|
||||||
string(1) "C"
|
string(1) "C"
|
||||||
}
|
}
|
||||||
|
[6]=>
|
||||||
|
object(ReflectionProperty)#%d (2) {
|
||||||
|
["name"]=>
|
||||||
|
string(10) "hookNoVirt"
|
||||||
|
["class"]=>
|
||||||
|
string(1) "C"
|
||||||
|
}
|
||||||
|
[7]=>
|
||||||
|
object(ReflectionProperty)#%d (2) {
|
||||||
|
["name"]=>
|
||||||
|
string(8) "hookVirt"
|
||||||
|
["class"]=>
|
||||||
|
string(1) "C"
|
||||||
|
}
|
||||||
}
|
}
|
||||||
Private or static properties:array(6) {
|
Private or static properties:array(6) {
|
||||||
[0]=>
|
[0]=>
|
||||||
|
@ -187,3 +221,12 @@ Private or static properties:array(6) {
|
||||||
string(1) "C"
|
string(1) "C"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Virtual properties:array(1) {
|
||||||
|
[0]=>
|
||||||
|
object(ReflectionProperty)#%d (2) {
|
||||||
|
["name"]=>
|
||||||
|
string(8) "hookVirt"
|
||||||
|
["class"]=>
|
||||||
|
string(1) "C"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
|
@ -12,6 +12,8 @@ class C {
|
||||||
static private $a6;
|
static private $a6;
|
||||||
public final $a7;
|
public final $a7;
|
||||||
public static final $a8;
|
public static final $a8;
|
||||||
|
public $a9 { set { $this->a9 = strtoupper($value); } }
|
||||||
|
public $a10 { get { return 42; } }
|
||||||
}
|
}
|
||||||
|
|
||||||
class D extends C {
|
class D extends C {
|
||||||
|
@ -23,7 +25,7 @@ class D extends C {
|
||||||
static private $a6;
|
static private $a6;
|
||||||
}
|
}
|
||||||
|
|
||||||
for ($i = 1;$i <= 8;$i++) {
|
for ($i = 1;$i <= 10;$i++) {
|
||||||
$rp = new ReflectionProperty("C", "a$i");
|
$rp = new ReflectionProperty("C", "a$i");
|
||||||
echo "C::a$i: ";
|
echo "C::a$i: ";
|
||||||
var_dump($rp->getModifiers());
|
var_dump($rp->getModifiers());
|
||||||
|
@ -50,3 +52,7 @@ C::a7: int(33)
|
||||||
D::a7: int(33)
|
D::a7: int(33)
|
||||||
C::a8: int(49)
|
C::a8: int(49)
|
||||||
D::a8: int(49)
|
D::a8: int(49)
|
||||||
|
C::a9: int(1)
|
||||||
|
D::a9: int(1)
|
||||||
|
C::a10: int(513)
|
||||||
|
D::a10: int(513)
|
||||||
|
|
|
@ -14,6 +14,7 @@ printModifiers(ReflectionClass::IS_EXPLICIT_ABSTRACT);
|
||||||
printModifiers(ReflectionMethod::IS_ABSTRACT | ReflectionMethod::IS_FINAL);
|
printModifiers(ReflectionMethod::IS_ABSTRACT | ReflectionMethod::IS_FINAL);
|
||||||
printModifiers(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_STATIC | ReflectionProperty::IS_READONLY);
|
printModifiers(ReflectionProperty::IS_PUBLIC | ReflectionProperty::IS_STATIC | ReflectionProperty::IS_READONLY);
|
||||||
printModifiers(ReflectionClass::IS_READONLY);
|
printModifiers(ReflectionClass::IS_READONLY);
|
||||||
|
printModifiers(ReflectionProperty::IS_VIRTUAL);
|
||||||
?>
|
?>
|
||||||
--EXPECT--
|
--EXPECT--
|
||||||
private
|
private
|
||||||
|
@ -23,3 +24,4 @@ abstract
|
||||||
abstract,final
|
abstract,final
|
||||||
public,static,readonly
|
public,static,readonly
|
||||||
readonly
|
readonly
|
||||||
|
virtual
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue