Fatal error: Cannot re-assign $this -- any plans to "fix" this limitation?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Are there any plans to fix this "bug" (or add this as a feature depending on
your POV)
 
I have a connection class that uses singletons for each database. We have
replication on our PROD boxes but on our VMs we don't, so the code does a
little magic to determine if it's an INSERT|UPDATE|DELETE|REPLACE and tries
to change to the proper mysql connection (write to master, read from slaves
in the case of PROD and just use the same DB on the VM).
 
The problem, and it's quite frustrating considering it doesn't make a lot of
logical sense why you couldn't do it, is that PHP doesn't allow the
re-assignment of $this. :-\
 
Both of these fail (of course)
 
$this = Connection::get_instance(self::_determine_RDBMS($mybase[1], true));
 
$this = self::$_instance_array[$this->_base];
 
It seems that it should be code-wise do-able by simply having the guts of
PHP (the C/C++ code PHP is created with) create a new object - just as it
did when creating $this, then just change the pointer that $this is looking
at to the new object, throw the old object onto the heap for cleanup. Why is
that so difficult?
 
 

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux