summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDmitry Stogov <dmitry@php.net>2008-01-29 11:13:52 +0000
committerDmitry Stogov <dmitry@php.net>2008-01-29 11:13:52 +0000
commite8ecba4872be9fc7ddfc099be4ec41e8ac2682d7 (patch)
treea89893d65a176ac2878ebfc064797d57a83d6337
parentc5959feae175013ad120e585bf4d58d5c0ddbb29 (diff)
downloadphp-git-e8ecba4872be9fc7ddfc099be4ec41e8ac2682d7.tar.gz
Fixed bug #43323 (Wrong count abstract methods). (Felipe, Dmitry)
-rw-r--r--Zend/tests/bug43323.phpt12
-rw-r--r--Zend/zend_execute_API.c12
2 files changed, 23 insertions, 1 deletions
diff --git a/Zend/tests/bug43323.phpt b/Zend/tests/bug43323.phpt
new file mode 100644
index 0000000000..d366a6dd1f
--- /dev/null
+++ b/Zend/tests/bug43323.phpt
@@ -0,0 +1,12 @@
+--TEST--
+Bug #43323 (Wrong count abstract methods)
+--FILE--
+<?php
+abstract class bar {
+ abstract public function bar();
+}
+
+class foo extends bar {
+}
+--EXPECTF--
+Fatal error: Class foo contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (bar::bar) in %sbug43323.php on line 7
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index 412875165d..a4a2183d76 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1877,6 +1877,7 @@ zend_class_entry *zend_fetch_class(char *class_name, uint class_name_len, int fe
typedef struct _zend_abstract_info {
zend_function *afn[MAX_ABSTRACT_INFO_CNT + 1];
int cnt;
+ int ctor;
} zend_abstract_info;
static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC) /* {{{ */
@@ -1885,7 +1886,16 @@ static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_
if (ai->cnt < MAX_ABSTRACT_INFO_CNT) {
ai->afn[ai->cnt] = fn;
}
- ai->cnt++;
+ 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++;
+ }
}
return 0;
}