cvs: ZendEngine2 / zend_execute_API.c /tests bug43323.phpt

[email protected] ("Dmitry Stogov")
Newsgroups php.zend-engine.cvs
Message-ID <cvsdmitry1201605232@cvsserver>
dmitry		Tue Jan 29 11:13:52 2008 UTC

  Modified files:              
    /ZendEngine2	zend_execute_API.c 
    /ZendEngine2/tests	bug43323.phpt 
  Log:
  Fixed bug #43323 (Wrong count abstract methods). (Felipe, Dmitry)
  
  
http://cvs.php.net/viewvc.cgi/ZendEngine2/zend_execute_API.c?r1=1.433&r2=1.434&diff_format=u
Index: ZendEngine2/zend_execute_API.c
diff -u ZendEngine2/zend_execute_API.c:1.433 ZendEngine2/zend_execute_API.c:1.434
--- ZendEngine2/zend_execute_API.c:1.433	Thu Jan 24 09:41:48 2008
+++ ZendEngine2/zend_execute_API.c	Tue Jan 29 11:13:52 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: zend_execute_API.c,v 1.433 2008/01/24 09:41:48 dmitry Exp $ */
+/* $Id: zend_execute_API.c,v 1.434 2008/01/29 11:13:52 dmitry Exp $ */
 
 #include <stdio.h>
 #include <signal.h>
@@ -1877,6 +1877,7 @@
 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 @@
 		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;
 }
http://cvs.php.net/viewvc.cgi/ZendEngine2/tests/bug43323.phpt?r1=1.1&r2=1.2&diff_format=u
Index: ZendEngine2/tests/bug43323.phpt
diff -u /dev/null ZendEngine2/tests/bug43323.phpt:1.2
--- /dev/null	Tue Jan 29 11:13:52 2008
+++ ZendEngine2/tests/bug43323.phpt	Tue Jan 29 11:13:52 2008
@@ -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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.