Im moving one of our clients web site to a new hosting company.
The new hosting company uses PHP 5.3.14
I tested this site on company's test machine which runs PHP 5.1.6 and everything worked fine.
However, when I moved the site to new hosting company's server, it gave me the following error:
Fatal error: Call to undefined method DAOtemplate_Ex::DAOparent_Ex() in /var/www/html/nna_test/data/class_core/db/DAO_gate.php on line 20
Here is my DAO_gate.php
<?php
require_once CLASS_CORE_EX_REALDIR . 'db_extends/DAOtemplate_Ex.php';
class DAO_gate extends DAOtemplate_Ex
{
function DAO_gate( $value1="" )
{
parent::DAOparent_Ex(); ---***LINE 20***---
$this->m_tablename = "dtb_gate";
$this->m_struct = array();
$this->m_struct_foreignKey = array();
$this->m_struct_foreignKey_target = array();
// get: table struct.
$this->CDB->SetQuery( "show full columns from ". $this->m_tablename );
$this->CDB->ExecQuery();
while( $row = $this->CDB->GetRecord() ) {
$this->m_struct[] = $row;
}
$this->init();
}
.blah
.blah
.blah
}
and the DAOtemplate_Ex which DAO_gate.php extends is as follows
<?php
// {{{ requires
require_once CLASS_CORE_REALDIR . 'db/DAOtemplate.php';
class DAOtemplate_Ex extends DAOtemplate
{
}
?>
DAOtemplate_Ex extends DAOtemplate
<?php
require_once CLASS_CORE_EX_REALDIR . 'db_extends/DAOparent_Ex.php';
class DAOtemplate extends DAOparent_Ex
{
var $m_tablename;
var $m_struct;
var $m_struct_foreignKey;
var $m_struct_foreignKey_target;
function DAOtemplate( $value1="" )
{
parent::DAOparent_Ex();
$this->m_tablename = "";
$this->m_struct = array();
$this->m_struct_foreignKey = array();
$this->m_struct_foreignKey_target = array();
$this->CDB->SetQuery( "show full columns from ". $this->m_tablename );
$this->CDB->ExecQuery();
while( $row = $this->CDB->GetRecord() ) {
$this->m_struct[] = $row;
}
$this->init();
}
.blah
.blah
.blah
}
DAOparent_Ex :
<?php
require_once CLASS_CORE_REALDIR . 'db/DAOparent.php';
class DAOparent_Ex extends DAOparent
{
}
?>
And Finally DAOparent :
<?php
require_once CLASS_CORE_REALDIR . 'db/SC_DBFactory.php';
class DAOparent
{
var $CDB;
var $m_use_sql;
function DAOparent()
{
if( empty( $value1 ) )
{
$this->CDB = SC_DBFactory::GetInstance( DB_TYPE );
$this->CDB->SetDBType( DB_TYPE );
$this->CDB->SetHost( DB_SERVER );
$this->CDB->SetDBName( DB_NAME );
$this->CDB->SetUserName( DB_USER );
$this->CDB->SetPassword( DB_PASSWORD );
$this->CDB->SetCharaCode( DB_ENCODING );
} else {
if( is_object( $value1 ) )
{
$this->CDB = $value1;
} else {
// error:
print( "connect faild." );
die();
}
}
$this->CDB->Connect();
$this->m_use_sql = array( "select", "update", "insert", "delete", "begin", "rollback" );
$this->init();
}
function init()
{
}
.blah
.blah
.blah
}
Does anyone know the problem?
I thought its something because of empty Classes.
And I apologize for posting such long codes.
Looking through your code, I think that PHP is right! There is no method DAOparent_Ex
in the parent class.
I am not sure why it passed in PHP 5.1 and perhaps PHP 5.3 is more strict.
What are you trying to achieve bij calling parent::DAOparent_Ex()
? Calling the __construct
of the parent DAOparent_Ex()
class?