mirror of
https://github.com/php/php-src.git
synced 2026-04-26 17:38:14 +02:00
Fixes for abstract classes/methods
This commit is contained in:
+6
-3
@@ -1245,12 +1245,15 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr
|
||||
} else {
|
||||
internal_function->fn_flags = ZEND_ACC_PUBLIC;
|
||||
}
|
||||
if (ptr->flags&ZEND_ACC_ABSTRACT) {
|
||||
if (ptr->flags & ZEND_ACC_ABSTRACT) {
|
||||
if (scope) {
|
||||
scope->ce_flags |= ZEND_ACC_ABSTRACT_CLASS;
|
||||
scope->ce_flags |= ZEND_ACC_ABSTRACT;
|
||||
if (!(scope->ce_flags & ZEND_ACC_INTERFACE)) {
|
||||
scope->ce_flags |= ZEND_ACC_ABSTRACT_CLASS;
|
||||
}
|
||||
}
|
||||
} else {
|
||||
if (scope && scope->ce_flags&ZEND_ACC_INTERFACE) {
|
||||
if (scope && (scope->ce_flags & ZEND_ACC_INTERFACE)) {
|
||||
zend_error(error_type, "Interface %s cannot contain non abstract method %s()", scope->name, ptr->fname);
|
||||
return FAILURE;
|
||||
}
|
||||
|
||||
+4
-1
@@ -2563,7 +2563,10 @@ void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRML
|
||||
if (!(ce->ce_flags & ZEND_ACC_INTERFACE)
|
||||
&& !(ce->ce_flags & ZEND_ACC_ABSTRACT_CLASS)
|
||||
&& ((parent_token->op_type != IS_UNUSED) || (ce->num_interfaces > 0))) {
|
||||
do_verify_abstract_class(TSRMLS_C);
|
||||
zend_verify_abstract_class(ce TSRMLS_CC);
|
||||
if (ce->parent || ce->num_interfaces) {
|
||||
do_verify_abstract_class(TSRMLS_C);
|
||||
}
|
||||
}
|
||||
CG(active_class_entry) = NULL;
|
||||
}
|
||||
|
||||
+1
-1
@@ -3167,7 +3167,7 @@ int zend_switch_free_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
|
||||
int zend_new_handler(ZEND_OPCODE_HANDLER_ARGS)
|
||||
{
|
||||
if (EX_T(opline->op1.u.var).class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_ABSTRACT_CLASS)) {
|
||||
if (EX_T(opline->op1.u.var).class_entry->ce_flags & (ZEND_ACC_INTERFACE|ZEND_ACC_ABSTRACT|ZEND_ACC_ABSTRACT_CLASS)) {
|
||||
char *class_type;
|
||||
|
||||
if (EX_T(opline->op1.u.var).class_entry->ce_flags & ZEND_ACC_INTERFACE) {
|
||||
|
||||
Reference in New Issue
Block a user