mirror of
https://github.com/php/php-src.git
synced 2025-08-15 21:48:51 +02:00
Merge branch 'PHP-8.1'
* PHP-8.1: Fix generation of property with class union type Replace SKIPIF with EXTENSIONS
This commit is contained in:
commit
d362caed2c
5 changed files with 19 additions and 6 deletions
|
@ -273,6 +273,9 @@ typedef struct {
|
|||
#define ZEND_TYPE_INIT_PTR_MASK(ptr, type_mask) \
|
||||
{ (void *) (ptr), (type_mask) }
|
||||
|
||||
#define ZEND_TYPE_INIT_UNION(ptr, extra_flags) \
|
||||
{ (void *) (ptr), (_ZEND_TYPE_LIST_BIT|_ZEND_TYPE_UNION_BIT) | (extra_flags) }
|
||||
|
||||
#define ZEND_TYPE_INIT_CLASS(class_name, allow_null, extra_flags) \
|
||||
ZEND_TYPE_INIT_PTR(class_name, _ZEND_TYPE_NAME_BIT, allow_null, extra_flags)
|
||||
|
||||
|
|
|
@ -1460,7 +1460,7 @@ class PropertyInfo
|
|||
|
||||
$typeMaskCode = $this->type->toArginfoType()->toTypeMask();
|
||||
|
||||
$code .= "\tzend_type property_{$propertyName}_type = ZEND_TYPE_INIT_PTR(property_{$propertyName}_type_list, _ZEND_TYPE_LIST_BIT, 0, $typeMaskCode);\n";
|
||||
$code .= "\tzend_type property_{$propertyName}_type = ZEND_TYPE_INIT_UNION(property_{$propertyName}_type_list, $typeMaskCode);\n";
|
||||
$typeCode = "property_{$propertyName}_type";
|
||||
} else {
|
||||
$escapedClassName = $arginfoType->classTypes[0]->toEscapedName();
|
||||
|
|
12
ext/reflection/tests/internal_property_union_type.phpt
Normal file
12
ext/reflection/tests/internal_property_union_type.phpt
Normal file
|
@ -0,0 +1,12 @@
|
|||
--TEST--
|
||||
Union type on internal property
|
||||
--EXTENSIONS--
|
||||
zend_test
|
||||
--FILE--
|
||||
<?php
|
||||
$rp = new ReflectionProperty(_ZendTestClass::class, 'classUnionProp');
|
||||
$rt = $rp->getType();
|
||||
echo $rt, "\n";
|
||||
?>
|
||||
--EXPECT--
|
||||
stdClass|Iterator|null
|
|
@ -1,9 +1,7 @@
|
|||
--TEST--
|
||||
ReflectionProperty::get/setValue() on internal static property
|
||||
--SKIPIF--
|
||||
<?php
|
||||
if (!class_exists('_ZendTestClass')) die('skip zend_test extension required');
|
||||
?>
|
||||
--EXTENSIONS--
|
||||
zend_test
|
||||
--FILE--
|
||||
<?php
|
||||
|
||||
|
|
|
@ -260,7 +260,7 @@ static zend_class_entry *register_class__ZendTestClass(zend_class_entry *class_e
|
|||
property_classUnionProp_type_list->num_types = 2;
|
||||
property_classUnionProp_type_list->types[0] = (zend_type) ZEND_TYPE_INIT_CLASS(property_classUnionProp_class_stdClass, 0, 0);
|
||||
property_classUnionProp_type_list->types[1] = (zend_type) ZEND_TYPE_INIT_CLASS(property_classUnionProp_class_Iterator, 0, 0);
|
||||
zend_type property_classUnionProp_type = ZEND_TYPE_INIT_PTR(property_classUnionProp_type_list, _ZEND_TYPE_LIST_BIT, 0, MAY_BE_NULL);
|
||||
zend_type property_classUnionProp_type = ZEND_TYPE_INIT_UNION(property_classUnionProp_type_list, MAY_BE_NULL);
|
||||
zval property_classUnionProp_default_value;
|
||||
ZVAL_NULL(&property_classUnionProp_default_value);
|
||||
zend_string *property_classUnionProp_name = zend_string_init("classUnionProp", sizeof("classUnionProp") - 1, 1);
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue