ID:          43323
 Updated by:  [EMAIL PROTECTED]
 Reported By: felipensp at gmail dot com
-Status:      Open
+Status:      Assigned
 Bug Type:    Scripting Engine problem
 PHP Version: 5.3
-Assigned To: 
+Assigned To: dmitry


Previous Comments:
------------------------------------------------------------------------

[2008-01-18 10:44:05] [EMAIL PROTECTED]

It also occur in PHP 5.3.

(Ugly?) patch:

Index: Zend/zend_execute_API.c
===================================================================
RCS file: /repository/ZendEngine2/zend_execute_API.c,v
retrieving revision 1.331.2.20.2.24.2.19
diff -u -u -r1.331.2.20.2.24.2.19 zend_execute_API.c
--- Zend/zend_execute_API.c     15 Jan 2008 11:47:05 -0000     
1.331.2.20.2.24.2.19
+++ Zend/zend_execute_API.c     18 Jan 2008 10:32:51 -0000
@@ -1649,15 +1649,21 @@
 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) /* {{{ */
 {
        if (fn->common.fn_flags & ZEND_ACC_ABSTRACT) {
-               if (ai->cnt < MAX_ABSTRACT_INFO_CNT) {
+               if (ai->cnt < MAX_ABSTRACT_INFO_CNT &&
((fn->common.fn_flags & ZEND_ACC_CTOR) == 0 || ai->ctor < 1)) {
                        ai->afn[ai->cnt] = fn;
                }
-               ai->cnt++;
+               if (!ai->ctor || !(fn->common.fn_flags &
ZEND_ACC_CTOR)) {
+                       ai->cnt++;
+               }
+               if (!ai->ctor && fn->common.fn_flags & ZEND_ACC_CTOR)
{
+                       ai->ctor = 1;
+               }
        }
        return 0;
 }


------------------------------------------------------------------------

[2007-11-18 13:42:05] felipensp at gmail dot com

Description:
------------
Wrong count abstract methods when name of method is same class name.

When used the same code with namespace, the count is correct.

Reproduce code:
---------------
<?php

// namespace foo; # The count is correct

abstract class bar {
    abstract public function bar();
}

class foo extends bar {
}


Expected result:
----------------
Fatal error: Class foo contains 1 abstract methods and must therefore
be declared abstract or implement the remaining methods (bar::bar)

Actual result:
--------------
Fatal error: Class foo contains 2 abstract methods and must therefore
be declared abstract or implement the remaining methods (bar::bar,
bar::bar)


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=43323&edit=1

Reply via email to