Re: Re: #23505 [Csd->Asn]: debug_backtrace inside overloaded __call method segfaults
| From: | Moriyoshi Koizumi | Date: | Fri, 16 May 2003 07:31:58 +0000 |
| Subject: | Re: Re: #23505 [Csd->Asn]: debug_backtrace inside overloaded __call method segfaults | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-1560@lists.php.net to get a copy of this message | ||
"Thies C. Arntzen" <thies@thiesos.org> wrote:
> On Fri, May 16, 2003 at 03:47:07PM +0900, Moriyoshi Koizumi wrote:
> > thies@php.net wrote:
> >
> > > jani, your fix won't work if you call a function in an
> > > overloaded object from a funtion in an overloaded
> > > object;-) calling get_active_function_name() inside
> > > debug_backtrace doesn't seem right to me.
> > > i will try to find some time to investigate myself.
> >
> > Indeed I took the problem you pointed out into account..
> > IIRC, overloaded handlers are never invoked recursively
> > because of DISABLE_HANDLER() calls placed within each handler
> > function in ext/overload/overload.c .
>
> but this is only tru for the object "we're in" - if were
> calling out to another overloaded object your assumption is
> not correct.
Hmm, I see. It's actually more complicated than I expected. The following
script produces some weird output and then segfaults:
<?php
class test1 {
function test1() {}
function __call($method,$params,&$return) {
$test2 = new test2();
var_dump($test2->foo);
}
}
class test2 {
function test2() {}
function __get($prop, &$val) {
$val = debug_backtrace();
return true;
}
}
overload('test1');
overload('test2');
$t = new test1();
$t->foo();
?>
Moriyoshi
p.s. why not allow overload() to accept multiple class names at once..?