PEAR is discontinued

This is a static archive preserving historical releases and metadata. No new packages or updates will be published. For updates to existing packages, or to publish new packages, please use Composer and Packagist.

Home » Configuration » Config » Bug #2780

Cannot re-assign $this in Container.php

Details

Submitted2004-11-18 04:52 UTC
Fromkiryu at angelicwing dot net
StatusBogus
PackageConfig
PHP Version5CVS-2004-11-17 (dev)
OSFreeBSD4.9
Roadmaps(Not assigned)

Comments

[2004-11-18 04:52 UTC] kiryu at angelicwing dot net

Description:
------------
I guess this is no more vaild in the ZendEngine2:
$target =& $this;

Expected result:
----------------
no fatal error

Actual result:
--------------
Fatal error: Cannot re-assign $this in /Path/To/pear/Config/Container.php on line 125

[2004-11-23 04:00 UTC] ryansking at mac dot com

This bug is perplexing me. The error says that $this
cannot be re-assigned, which is a known change in php5.
But, $this is not being re-assigned, $target is.

[2004-12-09 17:45 UTC] ryansking at mac dot com

Not enough information was provided for us to be able
to handle this bug. Please re-read the instructions at
http://bugs.php.net/how-to-report.php

If you can provide more information, feel free to add it
to this bug and change the status back to "Open".

Thank you for your interest in PEAR.

I can't reproduce this and I've gotten no input from the
bug reporter on this.

[2005-06-07 17:18 UTC] pear at greywyvern dot com

$this does not have to be "reassigned" by the coder; the mere use of it outside of a class structure causes PHP to try to "assign" it to one, and finding none, throws this error.

I was using a variable named $this in a function context and got this same error from all users who tried to use it on PHP5. I documented a fix here: <http://www.greywyvern.com/forum.php?msg=545> Just changing the name of the $this variable to something else was all that was necessary.

Note: This error will *not* appear in 4.x.x versions of PHP. ONLY in 5.x.x