List Info

Thread: DB-1.7.13 (stable) Released.




DB-1.7.13 (stable) Released.
user name
2007-09-23 15:39:12
--On September 21, 2007 Sep 21, 15:16.43 +0000 PEAR
Announce
<pear-devlists.php.net> wrote:

> * Replaced instances of '=& new Foo' with '= new
Foo' to make DB (slightly)
> more E_STRICT friendly.  Request 11581.

All,

Could someone hit me with the clue-bat on this. just send me
off to rtfm if
this is explained clearly in one spot. 

I know that "$x =& new Foo()" is 'out' in
php5.

but in PHP4, the "$x =& new Foo" construct
used to make a new Foo instance,
then make $x refer to that instance. And "$x = new
Foo" use to make a new Foo,
then make $x be a *copy* of that new Foo. I have this vague
recollection of
falling over this in some project. I had used the "$x =
new Foo" contruct and
took me a while to discover there were really two Foo
instances in that one
line of code. When I changed to =& my problem was
resolved. So I dutifully
started "=& new" all my objects in php4

so my questions:

- is my understanding above, in php4 context, correct? (I
have legacty code to
maintain ya know.)

- and how does "$x = new Foo" work in php5?  does
it 'just work correctly' thus
we no longer needed the "$x =& new Foo" from
php4. 


-c

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: DB-1.7.13 (stable) Released.
user name
2007-09-23 16:08:01
> > * Replaced instances of '=& new Foo' with '=
new Foo' to make DB
> > (slightly) more E_STRICT friendly.  Request
11581.
> - and how does "$x = new Foo" work in php5? 
does it 'just work
> correctly' thus we no longer needed the "$x =&
new Foo" from php4. 

Removing the & does make the code behave different in
PHP4, but stays the same in PHP5. So it's a BC break. Since
DB shouldn't be used anymore, this should not have been
changed at all.

-- 
Mit freundlichen Grüßen/Regards,
Christian Weiske

--
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


Re: DB-1.7.13 (stable) Released.
user name
2007-09-23 20:15:15
On 9/23/07, Craig Constantine <cconstantinephp.net> wrote:
> --On September 21, 2007 Sep 21, 15:16.43 +0000 PEAR
Announce
> <pear-devlists.php.net> wrote:
>
> > * Replaced instances of '=& new Foo' with '=
new Foo' to make DB (slightly)
> > more E_STRICT friendly.  Request 11581.
>
> All,
>
> Could someone hit me with the clue-bat on this. just
send me off to rtfm if
> this is explained clearly in one spot. 
>
> I know that "$x =& new Foo()" is 'out' in
php5.
>
> but in PHP4, the "$x =& new Foo"
construct used to make a new Foo instance,
> then make $x refer to that instance. And "$x = new
Foo" use to make a new Foo,
> then make $x be a *copy* of that new Foo. I have this
vague recollection of
> falling over this in some project. I had used the
"$x = new Foo" contruct and
> took me a while to discover there were really two Foo
instances in that one
> line of code. When I changed to =& my problem was
resolved. So I dutifully
> started "=& new" all my objects in php4
>

This is exactly why I have always used =& in my PHP4
code. You can
introduce subtle bugs if you don't use it, such as if, in
the
constructor, a reference to the object that is being
instantiated is
stored somewhere (such as in a sub-class). Various PEAR
classes *will*
break if code is changed to use = rather than =&.

> so my questions:
>
> - is my understanding above, in php4 context, correct?
(I have legacty code to
> maintain ya know.)
>
> - and how does "$x = new Foo" work in php5? 
does it 'just work correctly' thus
> we no longer needed the "$x =& new Foo"
from php4.
>


-- 
Justin Patrin

-- 
PEAR Development Mailing List (http://pear.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php


[1-3]

about | contact  Other archives ( Real Estate discussion Medical topics )