mirror of
https://github.com/php/php-src.git
synced 2025-08-16 05:58:45 +02:00
ReflectionClass::isCloneable()
: reduce duplication (GH-17795)
When the `zend_class_entry` has a `zend_function` entry for `clone`, the logic is the same regardless of if the `reflection_object` entry has an object or not; the determination is based solely on the flags of the `zend_function`.
This commit is contained in:
parent
77d748617a
commit
07e5f6fc3d
1 changed files with 10 additions and 15 deletions
|
@ -4828,15 +4828,11 @@ ZEND_METHOD(ReflectionClass, isCloneable)
|
||||||
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_ENUM)) {
|
if (ce->ce_flags & (ZEND_ACC_INTERFACE | ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS | ZEND_ACC_IMPLICIT_ABSTRACT_CLASS | ZEND_ACC_ENUM)) {
|
||||||
RETURN_FALSE;
|
RETURN_FALSE;
|
||||||
}
|
}
|
||||||
if (!Z_ISUNDEF(intern->obj)) {
|
|
||||||
if (ce->clone) {
|
if (ce->clone) {
|
||||||
RETURN_BOOL(ce->clone->common.fn_flags & ZEND_ACC_PUBLIC);
|
RETURN_BOOL(ce->clone->common.fn_flags & ZEND_ACC_PUBLIC);
|
||||||
} else {
|
|
||||||
RETURN_BOOL(Z_OBJ_HANDLER(intern->obj, clone_obj) != NULL);
|
|
||||||
}
|
}
|
||||||
} else {
|
if (!Z_ISUNDEF(intern->obj)) {
|
||||||
if (ce->clone) {
|
RETURN_BOOL(Z_OBJ_HANDLER(intern->obj, clone_obj) != NULL);
|
||||||
RETURN_BOOL(ce->clone->common.fn_flags & ZEND_ACC_PUBLIC);
|
|
||||||
} else {
|
} else {
|
||||||
if (UNEXPECTED(object_init_ex(&obj, ce) != SUCCESS)) {
|
if (UNEXPECTED(object_init_ex(&obj, ce) != SUCCESS)) {
|
||||||
return;
|
return;
|
||||||
|
@ -4847,7 +4843,6 @@ ZEND_METHOD(ReflectionClass, isCloneable)
|
||||||
zval_ptr_dtor(&obj);
|
zval_ptr_dtor(&obj);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
|
||||||
/* }}} */
|
/* }}} */
|
||||||
|
|
||||||
/* {{{ Returns whether this is an interface or a class */
|
/* {{{ Returns whether this is an interface or a class */
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue