PHP 5.x Derived Classes Error
Posted: Tue Aug 26, 2008 2:40 am
I had a script that was working fine before when it was on an older version of PHP. But when I switched servers and the new environment uses PHP 5.0. I'm getting this bizarre array error.
This is what comes up on the web page:
Error Message:
Fatal error: The AddDataObject() function requires DataObject derived classes. Current internal array count is 2 in /services3/webpages/f/v/fvvc.bc.ca/public/admin/classes/listserve/class.abstract_dao.php on line 645
Here is code for the function:
I'd assume you need more info to figure out my problem. So just let me know what it is and I will try to find it in the code.
The database is also running on a MySQL 5, before it was running on 4.x so I'm not sure if that might have anything to do with it.
Here is the entire source for the main page which sends the data to the various classes.
class.contact_manager.php
http://pastebin.com/mde31be3
This is the error i'm getting.
http://pastebin.com/m2f06caba
class.abstract_dao.php
http://pastebin.com/m12f9daa4
The code which is dealing with the DataObjects function are on lines 320 - 334
This is what comes up on the web page:
Code: Select all
Trying to add:
To
Array
(
[0] => CountColumn Object
(
[_m_DefaultValue] => 1
[_m_CurrentValue] => 1
[_m_Name] => #
[_m_ImageFilename] =>
[_m_LinkURL] => contact_properties.php
[_m_Target] =>
[_m_SortAllowed] => 1
[_m_ConfirmationMessage] =>
[_m_ValuePrefix] =>
[_m_ValuePostfix] => .
[_m_MaxLength] =>
[_m_UsePopup] =>
[_m_PopupSettings] =>
[_m_DatabaseColumn] =>
[_m_DatabaseTable] =>
[_m_DatabaseColumnReference] =>
[_m_DatabaseTableReference] =>
[_m_SortDirection] =>
[_m_RelatedDataObjects] => Array
(
[ID] => DataObject Object
(
[_m_DatabaseColumn] => ID
[_m_DatabaseTable] => LSContacts
[_m_DatabaseColumnReference] =>
[_m_DatabaseTableReference] =>
[_m_SortDirection] =>
[_m_RelatedDataObjects] =>
[_m_ReadOnly] =>
)
)
[_m_ReadOnly] =>
)
[1] => Column Object
(
[_m_Name] => Name
[_m_ImageFilename] =>
[_m_LinkURL] => contact_properties.php
[_m_Target] =>
[_m_SortAllowed] => 1
[_m_ConfirmationMessage] =>
[_m_ValuePrefix] =>
[_m_ValuePostfix] =>
[_m_MaxLength] =>
[_m_UsePopup] =>
[_m_PopupSettings] =>
[_m_DatabaseColumn] => CONCAT(LSContacts.LastName, ', ', LSContacts.FirstName, ' ', LSContacts.MiddleName)
[_m_DatabaseTable] =>
[_m_DatabaseColumnReference] => Name
[_m_DatabaseTableReference] =>
[_m_SortDirection] =>
[_m_RelatedDataObjects] => Array
(
[ID] => DataObject Object
(
[_m_DatabaseColumn] => ID
[_m_DatabaseTable] => LSContacts
[_m_DatabaseColumnReference] =>
[_m_DatabaseTableReference] =>
[_m_SortDirection] =>
[_m_RelatedDataObjects] =>
[_m_ReadOnly] =>
)
)
[_m_ReadOnly] =>
)
)
Error Message:
Fatal error: The AddDataObject() function requires DataObject derived classes. Current internal array count is 2 in /services3/webpages/f/v/fvvc.bc.ca/public/admin/classes/listserve/class.abstract_dao.php on line 645
Here is code for the function:
Code: Select all
function AddDataObject(&$a_DataObject)
{
if ( is_a($a_DataObject, 'dataobject') ) {
// Save a reference to the column object.
$this->_m_DataObjects[] =& $a_DataObject;
}
else {
echo('<p>Trying to add:</p><pre>');
print_r($a_DataObject);
echo('</pre><p>To</p><pre>');
print_r($this->_m_DataObjects);
echo('</pre>');
$Error = "The AddDataObject() function requires DataObject derived classes. Current internal array count is " . count($this->_m_DataObjects);
trigger_error($Error, E_USER_ERROR);
}
}
I'd assume you need more info to figure out my problem. So just let me know what it is and I will try to find it in the code.
The database is also running on a MySQL 5, before it was running on 4.x so I'm not sure if that might have anything to do with it.
Here is the entire source for the main page which sends the data to the various classes.
class.contact_manager.php
http://pastebin.com/mde31be3
This is the error i'm getting.
http://pastebin.com/m2f06caba
class.abstract_dao.php
http://pastebin.com/m12f9daa4
The code which is dealing with the DataObjects function are on lines 320 - 334