Re: [PATCH] zend_complle.c
| From: | Yasuo Ohgaki | Date: | Thu, 28 Mar 2002 01:42:16 +0000 |
| Subject: | Re: [PATCH] zend_complle.c | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-81871@lists.php.net to get a copy of this message | ||
Wez noticed the patch cannot handle
<?php
class A { function foo() {} }
class B extends A {}
class C extends B { function foo() {} }
?>
since class entry's function(method) table does not store
inherited functions.
(it seems it's better to store method in class at compile
time, rahter than resolving at run time. e.g. better
performance with cache products)
Anyway, here is new patch that checks all parents.
Tested scripts are
<?php
class A {
function foo() { echo 'A';}
}
class B {
function foo() { echo 'B';}
function foo() { echo 'C';}
}
$A = new A;
$B = new B;
$A->foo();
$B->foo();
?>
<?php
class A { function foo() {} }
class B extends A {}
class C extends B { function foo() {} }
?>
<?php
class A { function foo() { echo 'A';}}
class B extends A {function foo() { echo 'B';}}
$A = new A;
$B = new B;
$A->foo();
$B->foo();
?>
--
Yasuo Ohgaki