# Reference Notice

- Thread: https://externals.io/message/17287
- Original archive: https://news-web.php.net/php.internals/17287
- Started by Robert Cummings on 2005-07-17T18:52:19+00:00
- Messages: 16
- Reply by email to internals@lists.php.net
- More for agents: search with https://externals.io/search.md?q={query} · JSON API at https://externals.io/api · documentation at https://externals.io/llms.txt

---

## #17287 — Robert Cummings — 2005-07-17T18:52:19+00:00

URL: https://externals.io/message/17287#17287

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.          |
`------------------------------------------------------------'

---

## #17289 — Matthew Charles Kavanagh — 2005-07-17T22:06:09+00:00

URL: https://externals.io/message/17287#17289 · In reply to: #17287

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:

>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.

---

## #17293 — Robert Cummings — 2005-07-17T22:55:24+00:00

URL: https://externals.io/message/17287#17293 · In reply to: #17289

> 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.          |
`------------------------------------------------------------'

---

## #17291 — Matthew Charles Kavanagh — 2005-07-17T23:07:07+00:00

URL: https://externals.io/message/17287#17291 · In reply to: #17293

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:

>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.

---

## #17292 — Robert Cummings — 2005-07-17T23:12:34+00:00

URL: https://externals.io/message/17287#17292 · In reply to: #17291

> 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.          |
`------------------------------------------------------------'

---

## #17294 — Matthew Charles Kavanagh — 2005-07-17T23:25:54+00:00

URL: https://externals.io/message/17287#17294 · In reply to: #17292

Enjoy your presumptions, I'm sure they're great fun at parties.

Robert Cummings wrote:

> Also,
>quite probably unlike you, many of us programmer try to make our code
>perfectly clean from notices and warnings

---

## #17295 — Robert Cummings — 2005-07-17T23:43:30+00:00

URL: https://externals.io/message/17287#17295 · In reply to: #17294

> 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.          |
`------------------------------------------------------------'

---

## #17296 — Rasmus Lerdorf — 2005-07-17T23:52:27+00:00

URL: https://externals.io/message/17287#17296 · In reply to: #17287

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:
> 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.

---

## #17297 — Robert Cummings — 2005-07-18T00:00:19+00:00

URL: https://externals.io/message/17287#17297 · In reply to: #17296

> 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:
> > […]
-- 
.------------------------------------------------------------.
| 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.          |
`------------------------------------------------------------'

---

## #17298 — Wez Furlong — 2005-07-18T00:47:26+00:00

URL: https://externals.io/message/17287#17298 · In reply to: #17293

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.



> 
> > […]
> 
> 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.          |
> `------------------------------------------------------------'

---

## #17299 — Robert Cummings — 2005-07-18T01:23:18+00:00

URL: https://externals.io/message/17287#17299 · In reply to: #17298

> 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.          |
`------------------------------------------------------------'

---

## #17305 — Lorenzo Alberton — 2005-07-18T06:03:06+00:00

URL: https://externals.io/message/17287#17305 · In reply to: #17296

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

---

## #17306 — Derick Rethans — 2005-07-18T06:42:05+00:00

URL: https://externals.io/message/17287#17306 · In reply to: #17305

> Rasmus Lerdorf wrote:
> > […]
> 
> 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

---

## #17342 — Andrey Nikolaev — 2005-07-20T11:57:59+00:00

URL: https://externals.io/message/17287#17342 · In reply to: #17287

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 :-/

---

## #17343 — Derick Rethans — 2005-07-20T12:08:18+00:00

URL: https://externals.io/message/17287#17343 · In reply to: #17342

> 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

---

## #17346 — Andrey Nikolaev — 2005-07-20T14:56:37+00:00

URL: https://externals.io/message/17287#17346 · In reply to: #17343

Derick Rethans wrote:
> 
> 
> 
> > […]
> 
> 
> 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...
