diff options
author | Dmitry Stogov <dmitry@zend.com> | 2018-08-27 12:56:17 +0300 |
---|---|---|
committer | Dmitry Stogov <dmitry@zend.com> | 2018-08-27 12:56:17 +0300 |
commit | ea9628936f00805554921390d052f92381966550 (patch) | |
tree | ca6db5b7cbb7baf366aa8f2628398b10ceb567e2 /Zend/zend_execute_API.c | |
parent | 02eded868c5fb307ce2b87042db1fd9a2e6ef1f7 (diff) | |
download | php-git-ea9628936f00805554921390d052f92381966550.tar.gz |
Move zend_verify_abstract_class() into zend_inheritance.c
Diffstat (limited to 'Zend/zend_execute_API.c')
-rw-r--r-- | Zend/zend_execute_API.c | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c index 9039855667..60260b9391 100644 --- a/Zend/zend_execute_API.c +++ b/Zend/zend_execute_API.c @@ -1374,65 +1374,6 @@ zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string } /* }}} */ -#define MAX_ABSTRACT_INFO_CNT 3 -#define MAX_ABSTRACT_INFO_FMT "%s%s%s%s" -#define DISPLAY_ABSTRACT_FN(idx) \ - ai.afn[idx] ? ZEND_FN_SCOPE_NAME(ai.afn[idx]) : "", \ - ai.afn[idx] ? "::" : "", \ - ai.afn[idx] ? ZSTR_VAL(ai.afn[idx]->common.function_name) : "", \ - ai.afn[idx] && ai.afn[idx + 1] ? ", " : (ai.afn[idx] && ai.cnt > MAX_ABSTRACT_INFO_CNT ? ", ..." : "") - -typedef struct _zend_abstract_info { - zend_function *afn[MAX_ABSTRACT_INFO_CNT + 1]; - int cnt; - int ctor; -} zend_abstract_info; - -static void zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai) /* {{{ */ -{ - if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) { - if (ai->cnt < MAX_ABSTRACT_INFO_CNT) { - ai->afn[ai->cnt] = fn; - } - if (fn->common.fn_flags & ZEND_ACC_CTOR) { - if (!ai->ctor) { - ai->cnt++; - ai->ctor = 1; - } else { - ai->afn[ai->cnt] = NULL; - } - } else { - ai->cnt++; - } - } -} -/* }}} */ - -void zend_verify_abstract_class(zend_class_entry *ce) /* {{{ */ -{ - zend_function *func; - zend_abstract_info ai; - - if ((ce->ce_flags & ZEND_ACC_IMPLICIT_ABSTRACT_CLASS) && !(ce->ce_flags & (ZEND_ACC_TRAIT | ZEND_ACC_EXPLICIT_ABSTRACT_CLASS))) { - memset(&ai, 0, sizeof(ai)); - - ZEND_HASH_FOREACH_PTR(&ce->function_table, func) { - zend_verify_abstract_class_function(func, &ai); - } ZEND_HASH_FOREACH_END(); - - if (ai.cnt) { - zend_error_noreturn(E_ERROR, "Class %s contains %d abstract method%s and must therefore be declared abstract or implement the remaining methods (" MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT MAX_ABSTRACT_INFO_FMT ")", - ZSTR_VAL(ce->name), ai.cnt, - ai.cnt > 1 ? "s" : "", - DISPLAY_ABSTRACT_FN(0), - DISPLAY_ABSTRACT_FN(1), - DISPLAY_ABSTRACT_FN(2) - ); - } - } -} -/* }}} */ - ZEND_API int zend_delete_global_variable(zend_string *name) /* {{{ */ { return zend_hash_del_ind(&EG(symbol_table), name); |