FAQ
hiho@ll

i was just asking myself, if it is possible, to get the return value of a
function after the function calls "return" (or throws an exception) and
before the value is returned

example:
class A{
public function __construct(){}
public function __destruct(){
// here i want the return value like:
$retval = idontknowwhichfunction();
print $retval; // this print's "test"
}
}

function B(){
$classvar = new A();

return "test";
}

i thought it would be a very impressive function for that purpose
for what i would need it:
think about testing a big php application
calling hundreds of functions and debugging them takes very long
but if i could track the arguments (debug_back_trace() function) AND the
return values (that's what i'm asking for) i could run a complete test and
after this i could change the input values automated and compare it with the
output i got before

another option for this, would be just debugging of such applications
cause it can be boring to debug big applications and with such a possibility
i can reproduce the problem very fast and at any point within my application

the question is:
Q1: how is the return value (return or throw) stored within php?
or another question would be: is it possible to write an extension
which can retrieve every variable set within my php session? (i know of the
security problems this produces, but until know, i'm evaluating if it can
work) and would be the return value within this variables?
any hint on this would be great!
since it's possible to create a sandbox within php (runkit extension) i
think it should be possible to get the return value (or exception object)
before the calling function receives it, not?
Q2: maybe i didn't find it, but is there a finished php function which i can
use like debug_back_trace but for the return value?
Q3: anybody has another idea for such a "testing" or debugging environment?
the main advantage of such a system would be: i can start debugging
from any point within my code and i could very easily create automated
test's which can compare the result (what it is and what it should be)
"automated"

thx@ll

Search Discussions

Discussion Posts

Follow ups

Related Discussions

Discussion Navigation
viewthread | post
posts ‹ prev | 1 of 3 | next ›
Discussion Overview
groupphp-internals @
categoriesphp
postedSep 26, '06 at 11:32a
activeSep 26, '06 at 4:24p
posts3
users3
websitephp.net

People

Translate

site design / logo © 2022 Grokbase