Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18330 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 11399 invoked by uid 1010); 24 Aug 2005 00:24:23 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 11384 invoked from network); 24 Aug 2005 00:24:23 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Aug 2005 00:24:23 -0000 X-Host-Fingerprint: 80.74.107.235 mail.zend.com Linux 2.5 (sometimes 2.4) (4) Received: from ([80.74.107.235:42026] helo=mail.zend.com) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id E8/48-28235-63EBB034 for ; Tue, 23 Aug 2005 20:24:23 -0400 Received: (qmail 27605 invoked from network); 24 Aug 2005 00:24:17 -0000 Received: from localhost (HELO ANDI-NOTEBOOK.zend.com) (127.0.0.1) by localhost with SMTP; 24 Aug 2005 00:24:17 -0000 Message-ID: <6.2.3.4.2.20050823172404.03719860@localhost> X-Mailer: QUALCOMM Windows Eudora Version 6.2.3.4 Date: Tue, 23 Aug 2005 17:24:14 -0700 To: "Sara Golemon" Cc: In-Reply-To: <010901c5a83f$7eb7ade0$5c8be5a9@ohr.berkeley.edu> References: <004501c5a813$1691dc30$5c8be5a9@ohr.berkeley.edu> <6.2.3.4.2.20050823161755.03bffe20@localhost> <010901c5a83f$7eb7ade0$5c8be5a9@ohr.berkeley.edu> Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii"; format=flowed Subject: Re: [PHP-DEV] Returning References from Internal Functions From: andi@zend.com (Andi Gutmans) OK thanks for the additional info. Will take a look. At 05:05 PM 8/23/2005, Sara Golemon wrote: > > We'll take a look at it as this should actually work today. > > >That's what I'd thought coming into this, but all my attempts to return a >reference failed: > >My Arg Info struct: >static > ZEND_BEGIN_ARG_INFO_EX(php_sample_retref_arginfo, 0, 1, 0) > ZEND_END_ARG_INFO() > >My reference linking: > if (return_value_ptr) { > zval_ptr_dtor(return_value_ptr); > } > SEPARATE_ZVAL_TO_MAKE_IS_REF(&val); > ZVAL_ADDREF(val); > *return_value_ptr = val; > > > >There's some commented out code in there that refers to bug 34045: >/* We shouldn't fix bad extensions here, > because it can break proper ones (Bug #34045) > if (!EX(function_state).function->common.return_reference) { > EX_T(opline->result.u.var).var.ptr->is_ref = 0; > EX_T(opline->result.u.var).var.ptr->refcount = 1; > } >*/ > >With that code in there returning references would certainly never work so >I'd be curious about the events leading up to that removal as much as >anything. > > > As to back porting, I don't think we should touch the stable branches. > > >Eh, it's a 50/50 on this one since the bug only effects internals code and >(last I checked) there's nothing internal that's trying to return a >reference other that OOP code (because it gets shoved into being a reference >anyway). I only came across this because I was trying to come up with some >example code "If you wanted to do this you could...". > >I know I personally would like to see it work in 5.1 at the least (being shy >of final such as we are...). As for 5.0... yeah let's sleeping dogs lie. > >-Sara