Reference Notice

php.internals

Robert Cummings

21 years ago
I think the reference notice stuff is a bit ridiculous. I mean I can understand the concern behind: function &foo() { return $fee.$fii; } But I mean the following gives errors too which is a bit too anal retentive even for my liking: function &foo() { $fee = 'bullshitBullshitBullshit'; return $fee; } function &fee() { return foo(); } fee(); Anyways my two cents. Seems moronic that I now need to worry about stupid reference notices X levels deep in the code for functions that I'm consuming. I gueeeeeeeeeeeeess I can assign return values EVERYWHERE to temporary variables just to get rid of the notices, but really, shouldn't the engine be happy enough returning references to it's own intermediate variable? I mean, heck, the engine knows enough to print a warning, it can do the work-- and a hell of a lot faster than developers having to temporarily assign everything. Cheers, Rob.
-- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

Matthew Charles Kavanagh

21 years ago
It's a notice. Your soul won't curdle and fall out of your ears just because your code produces a notice which you can easily prevent from being output. Robert Cummings wrote:

Robert Cummings

21 years ago
On Sun, 2005-07-17 at 18:06, Matthew Charles Kavanagh wrote:
> It's a notice. Your soul won't curdle and fall out of your ears just > because your code produces a notice which you can easily prevent from > being output.
My soul didn't curdle and fall out of my ears before the notice was added either and PHP can easily prevent the memory corruption without pissing off it's developer base with inane notices. Cheers, Rob.
-- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

Matthew Charles Kavanagh

21 years ago
Either way, I really don't think it's worth any fuss. It's just a notice, and whether it is there or not shouldn't really matter that much. This doesn't deserve all the attention it's been getting on this list. Robert Cummings wrote:

Robert Cummings

21 years ago
On Sun, 2005-07-17 at 19:07, Matthew Charles Kavanagh wrote:
> Either way, I really don't think it's worth any fuss. It's just a > notice, and whether it is there or not shouldn't really matter that > much. This doesn't deserve all the attention it's been getting on this list.
That's your opinion and while you are quite entitled to it, so are all of us who disagree with it. Additionally it's just a notice that didn't exist before, and has very questionable utility for existing now. Also, quite probably unlike you, many of us programmer try to make our code perfectly clean from notices and warnings, you can call us anal if you will, we'll just call you stupid when you come across a bug caused by unhandled notices and/or warnings. HAND, Rob.
-- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

Matthew Charles Kavanagh

21 years ago
Enjoy your presumptions, I'm sure they're great fun at parties. Robert Cummings wrote:

Robert Cummings

21 years ago
On Sun, 2005-07-17 at 19:25, Matthew Charles Kavanagh wrote:
> Enjoy your presumptions, I'm sure they're great fun at parties.
Yes, one of my favourites is that jaws are made of glass. Cheers, Rob.
-- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

Wez Furlong

21 years ago
If you think its so easy, why haven't we seen a patch to fix it coming from you? Now, stop wasting our time with your continued ranting (that applies to *everyone* who keeps going on-and-on-and-on-and-on about this) and let us get on with something more productive, which might even include making this situation better. --Wez. On 7/17/05, Robert Cummings <robert@interjinn.com> wrote:

Robert Cummings

21 years ago
On Sun, 2005-07-17 at 20:47, Wez Furlong wrote:
> If you think its so easy, why haven't we seen a patch to fix it coming from you?
Because I don't have time *pthththth*.
> Now, stop wasting our time with your continued ranting (that applies > to *everyone* who keeps going on-and-on-and-on-and-on about this) and > let us get on with something more productive, which might even include > making this situation better.
Well as Rasmus was nice enough to point out, the specific problem I pointed out is something under consideration as a bug and not the original "feature". As I originally said I didn't take issue with the reference notice in general, just where it deviated from practicality. Either way I wouldn't have continued along with my alleged rant if dumbass hadn't jumped on my back. Cheers, Rob.
-- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

Rasmus Lerdorf

21 years ago
Yes, we know there are still some issues here. People are working on it. Or there is at least intent to work on it. See http://bugs.php.net/bug.php?id=33643 -Rasmus Robert Cummings wrote:

Robert Cummings

21 years ago
On Sun, 2005-07-17 at 19:52, Rasmus Lerdorf wrote:
> Yes, we know there are still some issues here. People are working on > it. Or there is at least intent to work on it. See > http://bugs.php.net/bug.php?id=33643
Ahhh, very cool. Thanks. Cheers, Rob.
> Robert Cummings wrote: > > I think the reference notice stuff is a bit ridiculous. I mean I can > > understand the concern behind: > > > > function &foo() > > { > > return $fee.$fii; > > } > > > > But I mean the following gives errors too which is a bit too anal > > retentive even for my liking: > > > > function &foo() > > { > > $fee = 'bullshitBullshitBullshit'; > > > > return $fee; > > } > > > > function &fee() > > { > > return foo(); > > } > > > > fee(); > > > > Anyways my two cents. Seems moronic that I now need to worry about > > stupid reference notices X levels deep in the code for functions that > > I'm consuming. I gueeeeeeeeeeeeess I can assign return values EVERYWHERE > > to temporary variables just to get rid of the notices, but really, > > shouldn't the engine be happy enough returning references to it's own > > intermediate variable? I mean, heck, the engine knows enough to print a > > warning, it can do the work-- and a hell of a lot faster than developers > > having to temporarily assign everything.
-- .------------------------------------------------------------. | InterJinn Application Framework - http://www.interjinn.com | :------------------------------------------------------------: | An application and templating framework for PHP. Boasting | | a powerful, scalable system for accessing system services | | such as forms, properties, sessions, and caches. InterJinn | | also provides an extremely flexible architecture for | | creating re-usable components quickly and easily. | `------------------------------------------------------------'

Lorenzo Alberton

21 years ago
Rasmus Lerdorf wrote:
> Yes, we know there are still some issues here. People are working on > it. Or there is at least intent to work on it. See > http://bugs.php.net/bug.php?id=33643
actually this is the bug Robert was referring to: http://bugs.php.net/bug.php?id=33558 Regards,
-- Lorenzo Alberton http://pear.php.net/user/quipo

Derick Rethans

21 years ago
On Mon, 18 Jul 2005, Lorenzo Alberton wrote:
> Rasmus Lerdorf wrote: > > Yes, we know there are still some issues here. People are working on > > it. Or there is at least intent to work on it. See > > http://bugs.php.net/bug.php?id=33643 > > actually this is the bug Robert was referring to: > > http://bugs.php.net/bug.php?id=33558
Right, different issue. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Andrey Nikolaev

21 years ago
And another situation... <?php function &a() { if(1==2) return new B; //some reference... else return null; //error, we cant create B } $b_instance = a(); ?> And we got Notice... Notice: Only variable references should be returned by reference in - on line 6 But if we modify code to: <?php function &a() { $b = null; if(1==2) return new B; else return $b; } $b_instance = a(); ?> Than all ok, no notices, and i got what i want... but it's a kludge :-/

Derick Rethans

21 years ago
On Wed, 20 Jul 2005, Andrey Nikolaev wrote:
> function &a() { > if(1==2) > return new B; //some reference... > else > return null; //error, we cant create B > } > $b_instance = a(); > ?>
Why are you returning by reference in the first place here? "new B" already creates a copy. Derick
-- Derick Rethans http://derickrethans.nl | http://ez.no | http://xdebug.org

Andrey Nikolaev

21 years ago
Derick Rethans wrote:
> On Wed, 20 Jul 2005, Andrey Nikolaev wrote: > > >>function &a() { >> if(1==2) >> return new B; //some reference... >> else >> return null; //error, we cant create B >>} >>$b_instance = a(); >>?> > > > Why are you returning by reference in the first place here? "new B" > already creates a copy. > > Derick >
That's not a point, i'm telling about "return null". However "return & new B" is also not allowed...