Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:25836 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 86792 invoked by uid 1010); 26 Sep 2006 16:02:58 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 86777 invoked from network); 26 Sep 2006 16:02:58 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 26 Sep 2006 16:02:58 -0000 Authentication-Results: pb1.pair.com header.from=boards@gmail.com; sender-id=pass; domainkeys=good Authentication-Results: pb1.pair.com smtp.mail=boards@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 64.233.184.226 as permitted sender) DomainKey-Status: good X-DomainKeys: Ecelerity dk_validate implementing draft-delany-domainkeys-base-01 X-PHP-List-Original-Sender: boards@gmail.com X-Host-Fingerprint: 64.233.184.226 wr-out-0506.google.com Linux 2.4/2.6 Received: from [64.233.184.226] ([64.233.184.226:20224] helo=wr-out-0506.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 0D/C2-54386-13F49154 for ; Tue, 26 Sep 2006 12:02:57 -0400 Received: by wr-out-0506.google.com with SMTP id 55so940181wri for ; Tue, 26 Sep 2006 09:02:55 -0700 (PDT) DomainKey-Signature: a=rsa-sha1; q=dns; c=nofws; s=beta; d=gmail.com; h=received:from:reply-to:organization:to:subject:date:user-agent:references:in-reply-to:mime-version:content-type:content-transfer-encoding:message-id; b=JP+3QkkYekLNpCxhVOWLgyhrR7f7rYQWgs08FFqf5qDaEatJ/kUVY7qekuD1c0u32mCENEggeGL/5jgaMRNzB4zrNcUrVIV4mswYZc65VLMtcHCKEkWglr8MqZ4f2tvqNZtJist9t9ng7tpP/lO9BKJWT7jNsMvIvVD6dMtMib8= Received: by 10.90.94.2 with SMTP id r2mr407259agb; Tue, 26 Sep 2006 09:02:55 -0700 (PDT) Received: from wvaio ( [67.184.91.45]) by mx.gmail.com with ESMTP id 8sm3979899wra.2006.09.26.09.02.55; Tue, 26 Sep 2006 09:02:55 -0700 (PDT) Reply-To: boards@gmail.com Organization: LX To: internals@lists.php.net Date: Tue, 26 Sep 2006 11:02:53 -0500 User-Agent: KMail/1.9.4 References: In-Reply-To: MIME-Version: 1.0 Content-Type: multipart/signed; boundary="nextPart2472495.faIXQsWtNi"; protocol="application/pgp-signature"; micalg=pgp-sha1 Content-Transfer-Encoding: 7bit Message-ID: <200609261102.53901.boards@gmail.com> Subject: Re: [PHP-DEV] how is a return values stored? From: boards@gmail.com (Matt Sicker) --nextPart2472495.faIXQsWtNi Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Content-Disposition: inline On Tuesday 26 September 2006 06:32 am, Prometheus Prometheus wrote: > 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 =3D idontknowwhichfunction(); > print $retval; // this print's "test" > } > } > > function B(){ > $classvar =3D 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 Oh sweet, something I know! Return values are stored in zval *return_value. That's within any=20 function that follows the Zend format (i.e. ZEND_FUNCTION() macro to=20 declare it, returns value via the RETURN_*() macros). =2D-=20 Matt Sicker --nextPart2472495.faIXQsWtNi Content-Type: application/pgp-signature -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.4.2.2 (GNU/Linux) iD8DBQBFGU8t5tcAKF5t41MRAiD7AJ9JfyQjAl0cStI/ldrz1rhF0vLRYQCfQ128 RKU2PTEoQ2Mn6iE2tJAJyjQ= =+m9C -----END PGP SIGNATURE----- --nextPart2472495.faIXQsWtNi--