mirror of
https://github.com/php/php-src.git
synced 2024-09-21 09:57:23 +00:00
Currently we cannot support static ctor/dtor
This commit is contained in:
parent
0f1b506f20
commit
0f3374615b
@ -1283,9 +1283,15 @@ int zend_register_functions(zend_class_entry *scope, zend_function_entry *functi
|
|||||||
scope->clone = clone;
|
scope->clone = clone;
|
||||||
if (ctor) {
|
if (ctor) {
|
||||||
ctor->common.fn_flags |= ZEND_ACC_CTOR;
|
ctor->common.fn_flags |= ZEND_ACC_CTOR;
|
||||||
|
if (ctor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||||
|
zend_error(error_type, "Constructor %s::%s cannot be static", ctor->common.scope->name, ctor->common.function_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (dtor) {
|
if (dtor) {
|
||||||
dtor->common.fn_flags |= ZEND_ACC_DTOR;
|
dtor->common.fn_flags |= ZEND_ACC_DTOR;
|
||||||
|
if (dtor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||||
|
zend_error(error_type, "Destructor %s::%s cannot be static", dtor->common.scope->name, dtor->common.function_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return SUCCESS;
|
return SUCCESS;
|
||||||
|
@ -2277,9 +2277,15 @@ void zend_do_end_class_declaration(znode *class_token, znode *parent_token TSRML
|
|||||||
|
|
||||||
if (ce->constructor) {
|
if (ce->constructor) {
|
||||||
ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
|
ce->constructor->common.fn_flags |= ZEND_ACC_CTOR;
|
||||||
|
if (ce->constructor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||||
|
zend_error(E_COMPILE_ERROR, "Constructor %s::%s cannot be static", ce->name, ce->constructor->common.function_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
if (ce->destructor) {
|
if (ce->destructor) {
|
||||||
ce->destructor->common.fn_flags |= ZEND_ACC_DTOR;
|
ce->destructor->common.fn_flags |= ZEND_ACC_DTOR;
|
||||||
|
if (ce->destructor->common.fn_flags & ZEND_ACC_STATIC) {
|
||||||
|
zend_error(E_COMPILE_ERROR, "Destructor %s::%s cannot be static", ce->name, ce->destructor->common.function_name);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ce->line_end = zend_get_compiled_lineno(TSRMLS_C);
|
ce->line_end = zend_get_compiled_lineno(TSRMLS_C);
|
||||||
|
Loading…
Reference in New Issue
Block a user