Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:37558 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 14887 invoked from network); 9 May 2008 08:08:29 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 9 May 2008 08:08:29 -0000 Authentication-Results: pb1.pair.com header.from=hsantos@isdg.net; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=hsantos@isdg.net; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain isdg.net designates 208.247.131.9 as permitted sender) X-PHP-List-Original-Sender: hsantos@isdg.net X-Host-Fingerprint: 208.247.131.9 ntbbs.winserver.com Windows NT 4.0 (older) Received: from [208.247.131.9] ([208.247.131.9:1187] helo=winserver.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 10/92-00990-B7604284 for ; Fri, 09 May 2008 04:08:28 -0400 Received: from mail.winserver.com ([208.247.131.9]) by winserver.com (Wildcat! SMTP Router v6.3.452.5) for internals@lists.php.net; Fri, 09 May 2008 04:07:08 -0400 Received: from mail.winserver.com ([208.247.131.9]) by winserver.com (Wildcat! SMTP v6.3.452.5) with ESMTP id 761773937; Fri, 09 May 2008 04:07:07 -0400 Message-ID: <48240645.7060102@isdg.net> Date: Fri, 09 May 2008 04:07:33 -0400 Organization: Santronics Software, Inc. User-Agent: Thunderbird 2.0.0.0 (Windows/20070326) MIME-Version: 1.0 To: internals References: <021601c8b141$bbf64a50$4001a8c0@foxbox> <48238095.9060406@isdg.net> <001d01c8b16b$f5eb3a70$4001a8c0@foxbox> In-Reply-To: <001d01c8b16b$f5eb3a70$4001a8c0@foxbox> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] allow_call_time_pass_reference From: hsantos@isdg.net (Hector Santos) Steph Fox wrote: > The more I look into this, the weirder it seems. > > [snip] > > There's nothing wrong with it? > So why throw an error at all? > I have to say, I'm really confused over this. Either it's wrong, so you > deliver a warning, or it's OK, so you don't. But what *really* bothers > me is that the community seems to be under the impression that the rules > changed with PHP 5, which is absolutely untrue. This threw an E_NOTICE > under PHP 4.0 which has been shifted, first to E_STRICT (I haven't > checked this) and then to E_DEPRECATED in 5.3. +1, I agree. But I can only speak for 5.x since this is where the platform we decided to begin with PHP extension support. I didn't see the reason for it, but I also thought that it was to aggressive too. Meaning, I can see it applied to explicit PHP code, but not extensions. I can also see it as a LINT concept at the PHP code level which is one of the areas one might fall into bugs, i.e, not passing a reference when it was expected. This is a common concept with strong type-casting compilers, i.e. C/C++. I recall talking it over with some PHP veteran users helping with adding direct PHP support and the only reason I saw for it was a "Coding Style" push or mindset towards OOPs and functional programming; x = func(y), as oppose to func(x,&y); > All I know is it's slower in most (not all) situations. So the real > question is: should there be a warning at all? And if so, shouldn't it > be there by default? Passing by reference should be faster, not slower since the latter requires data to be pushed into the stack. But I see that as a moot point as both are natural considerations for programmers. In general, unless something is absolutely critical, I always leaned toward the theory of "Less Surprises & Working Code." I can see this more applicable to compiling PHP code or run time warnings for explicit PHP code. For extensions, where the Programmer has to do a lot more to make parameter referencing work with ZEND in the first place, there is an explicit intent to expose an API with functions containing variable pointers. In this case, IMO, the compromise might be to offer the option as an [Extension_name] option. I think in the end Steve, users are going to do what it takes anyway. Set the option on to support some package they really, really, really want to use. I mean, they might not have a choice in the matter. I don't see a security reason for it. Its more of a coding style issue and users really don't give a hoot as long the package works for them. My 2 pennies of course :-) -- Hector