summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@zend.com>2018-08-27 12:56:17 +0300
committerDmitry Stogov <dmitry@zend.com>2018-08-27 12:56:17 +0300
commitea9628936f00805554921390d052f92381966550 (patch)
treeca6db5b7cbb7baf366aa8f2628398b10ceb567e2
parent02eded868c5fb307ce2b87042db1fd9a2e6ef1f7 (diff)
downloadphp-git-ea9628936f00805554921390d052f92381966550.tar.gz
Move zend_verify_abstract_class() into zend_inheritance.c
-rw-r--r--Zend/zend_execute.h1
-rw-r--r--Zend/zend_execute_API.c59
-rw-r--r--Zend/zend_inheritance.c59
-rw-r--r--Zend/zend_inheritance.h1
4 files changed, 60 insertions, 60 deletions
diff --git a/Zend/zend_execute.h b/Zend/zend_execute.h
index ac53d3ecfc..6b10c753fa 100644
--- a/Zend/zend_execute.h
+++ b/Zend/zend_execute.h
@@ -304,7 +304,6 @@ ZEND_API void zend_unset_timeout(void);
ZEND_API ZEND_NORETURN void zend_timeout(int dummy);
ZEND_API zend_class_entry *zend_fetch_class(zend_string *class_name, int fetch_type);
ZEND_API zend_class_entry *zend_fetch_class_by_name(zend_string *class_name, zend_string *lcname, int fetch_type);
-void zend_verify_abstract_class(zend_class_entry *ce);
ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function(zend_string *name);
ZEND_API zend_function * ZEND_FASTCALL zend_fetch_function_str(const char *name, size_t len);
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);
diff --git a/Zend/zend_inheritance.c b/Zend/zend_inheritance.c
index d36d3040cb..ef6864ecfe 100644
--- a/Zend/zend_inheritance.c
+++ b/Zend/zend_inheritance.c
@@ -1891,6 +1891,65 @@ void zend_check_deprecated_constructor(const zend_class_entry *ce) /* {{{ */
}
/* }}} */
+#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)
+ );
+ }
+ }
+}
+/* }}} */
+
/*
* Local variables:
* tab-width: 4
diff --git a/Zend/zend_inheritance.h b/Zend/zend_inheritance.h
index c95fd78b3e..e30e264110 100644
--- a/Zend/zend_inheritance.h
+++ b/Zend/zend_inheritance.h
@@ -31,6 +31,7 @@ ZEND_API void zend_do_implement_interfaces(zend_class_entry *ce);
ZEND_API void zend_do_inheritance(zend_class_entry *ce, zend_class_entry *parent_ce);
+void zend_verify_abstract_class(zend_class_entry *ce);
void zend_check_deprecated_constructor(const zend_class_entry *ce);
END_EXTERN_C()