Fixed bug #43323 (Wrong count abstract methods). (Felipe, Dmitry)

This commit is contained in:
Dmitry Stogov 2008-01-29 11:12:57 +00:00
parent e0ca3b2424
commit 9770b3cb00
3 changed files with 24 additions and 1 deletions

1
NEWS
View file

@ -106,6 +106,7 @@ PHP NEWS
- Fixed bug #43527 (DateTime created from a timestamp reports environment - Fixed bug #43527 (DateTime created from a timestamp reports environment
timezone). (Derick) timezone). (Derick)
- Fixed bug #43426 (crash on nested call_user_func() calls). (Dmitry) - Fixed bug #43426 (crash on nested call_user_func() calls). (Dmitry)
- Fixed bug #43323 (Wrong count abstract methods). (Felipe, Dmitry)
- Fixed bug #43075 (Support 2007-11-01T24:00:00+00:00). (Derick) - Fixed bug #43075 (Support 2007-11-01T24:00:00+00:00). (Derick)
- Fixed bug #43003 (Invalid timezone reported for DateTime objects constructed - Fixed bug #43003 (Invalid timezone reported for DateTime objects constructed
using a timestamp). (Derick) using a timestamp). (Derick)

12
Zend/tests/bug43323.phpt Normal file
View file

@ -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

View file

@ -1659,6 +1659,7 @@ check_fetch_type:
typedef struct _zend_abstract_info { typedef struct _zend_abstract_info {
zend_function *afn[MAX_ABSTRACT_INFO_CNT + 1]; zend_function *afn[MAX_ABSTRACT_INFO_CNT + 1];
int cnt; int cnt;
int ctor;
} zend_abstract_info; } zend_abstract_info;
static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC) /* {{{ */ static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_info *ai TSRMLS_DC) /* {{{ */
@ -1667,7 +1668,16 @@ static int zend_verify_abstract_class_function(zend_function *fn, zend_abstract_
if (ai->cnt < MAX_ABSTRACT_INFO_CNT) { if (ai->cnt < MAX_ABSTRACT_INFO_CNT) {
ai->afn[ai->cnt] = fn; 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; return 0;
} }