Reply to Object unexpectedly overwritten after upgrading to PHP 4.4.1

Your name:

Reply:


Posted by tigerincanada on 12/27/05 19:42

My host recently upgraded to PHP 4.4.1 and I started getting notes from
clients about "call to member function on a non-object" errors. After
investigating, I found the the object was getting overwritten, when
previously the code had worked as intended on PHP 4.3.10.

This is happening deep within a huge application, so I'm having trouble
coming up with a simple reproduce script, and would appreciate any help
or tips from others who've seen a similar problem.

Here's the guilty code segment:

$tax =& $client->getTax();
$order->setTax($tax);

....

Class Order
{
....
function setTax(&$tax) {
if (is_a($tax,'SalesTax')) {
$this->setTaxId($tax->getId());
$this->_tax =& $tax;
} else {
PEAR::raiseError('Expected Sales Tax',ERROR_OBJECT_EXPECTED);
}
}

function setTaxId($tid) {
if (($this->status == ORDER_QUOTE) or ($this->status ==
ORDER_SUSPENDED)) {
if ($this->tax_id != $tid) {
$this->tax_id = $tid;
$this->_tax = NULL;
$this->quotetime = NULL;
}
} else {
PEAR::raiseError('Can not change sales tax for order in
progress',ERROR_PROPERTY_LOCKED);
}
}
....
}

Expected Result:

$order is still an object

Actual Result:

$order is set to the value of $order->quotetime

I've checked, and $order is an object before the method call, but not
afterwards... very strange indeed

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация