diff options
| author | Marcus Boerger <helly@php.net> | 2004-01-24 16:59:24 +0000 |
|---|---|---|
| committer | Marcus Boerger <helly@php.net> | 2004-01-24 16:59:24 +0000 |
| commit | 3ca44539a13d2815c30a7fd9b172adcb0f2666f0 (patch) | |
| tree | 8265b64b46f249c5c5bba412880df609f17002d1 /Zend/zend_API.c | |
| parent | e36cfeb0a9cda2399627910785e68fa5b3689269 (diff) | |
| download | php-git-3ca44539a13d2815c30a7fd9b172adcb0f2666f0.tar.gz | |
Switch from ZEND_ACC_DYNAMIC to ZEND_ACC_ALLOW_STATIC and disallow calling
internal non-static methods statically.
# As discussed with Zeev:
# - For BC standard userspace methods allow this with an E_STRICT message.
# - If you want to implement an internal method taht can be called both
# statically and non-statically then use flag ZEND_ACC_ALLOW_STATIC.
# - Magic user space methods __*() cannot and __construct, __destruct,
# __clone can never be called statically.
Diffstat (limited to 'Zend/zend_API.c')
| -rw-r--r-- | Zend/zend_API.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/Zend/zend_API.c b/Zend/zend_API.c index ec6fb918db..40e80ff366 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -1293,22 +1293,25 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, zend_function_entr scope->destructor = dtor; scope->clone = clone; if (ctor) { - ctor->common.fn_flags |= ZEND_ACC_CTOR|ZEND_ACC_DYNAMIC; + 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); } + ctor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (dtor) { - dtor->common.fn_flags |= ZEND_ACC_DTOR|ZEND_ACC_DYNAMIC; + 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); } + dtor->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } if (clone) { - clone->common.fn_flags |= ZEND_ACC_CLONE|ZEND_ACC_DYNAMIC; + clone->common.fn_flags |= ZEND_ACC_CLONE; if (clone->common.fn_flags & ZEND_ACC_STATIC) { zend_error(error_type, "Constructor %s::%s cannot be static", clone->common.scope->name, clone->common.function_name); } + clone->common.fn_flags &= ~ZEND_ACC_ALLOW_STATIC; } } return SUCCESS; |
