#27659 [WFx->Bgs]: Cannot re-assign $this

From: Date: Tue, 23 Mar 2004 19:40:10 +0000
Subject: #27659 [WFx->Bgs]: Cannot re-assign $this
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-56692@lists.php.net to get a copy of this message
 ID:               27659
 Updated by:       helly@php.net
 Reported By:      js at enradia dot com
-Status:           Wont fix
+Status:           Bogus
 Bug Type:         Unknown/Other Function
 Operating System: linux 2.6.3
 PHP Version:      5.0.0RC1
 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

Actually this is expected behavior. We explicitly decided to have $this
being readonly because of interna problems with the new engine.


Previous Comments:
------------------------------------------------------------------------

[2004-03-23 13:57:53] pollita@php.net

Take a look at PEAR::DB for an example of using a factory method (i.e.:
  $foo = DB::connect($uri);  )

For background on why support for reassigning $this was dropped, take a
look at http://news.php.net ( php.internals mailing list in
particular
) or the ZendEngine2 mailing list which is archived at
http://www.zend.com


------------------------------------------------------------------------

[2004-03-23 13:52:42] js at enradia dot com

There is a _LOT_ of code out there using that. Metabase 
among others. Is there an alternative?  This could be a 
huge problem if there is none. 
 
Thanks

------------------------------------------------------------------------

[2004-03-23 13:38:14] pollita@php.net

This "feature" was undocumented in PHP4 and was never intended to work.
 

------------------------------------------------------------------------

[2004-03-23 13:09:12] js at enradia dot com

Description:
------------
When trying to reassign $this (from session data for 
example) I get an error: 
Fatal error: Cannot re-assign $this in... 
 
Code used: 
$this = unserialize($data); 
 
This works in php 4. Perhaps this is a feature change but 
I could not find a reference to any alternatives so I am 
submitting a bug just in case. 
 
Thanks! 
Joshua 

Reproduce code:
---------------
$this = unserialize($data);

Expected result:
----------------
Assignment of session or serialized data to $this object 

Actual result:
--------------
Fatal error: Cannot re-assign $this in... 
 


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=27659&edit=1


Thread (12 messages)

« previous php.bugs (#56692) next »