User tests: Successful: Unsuccessful:
Pull Request for Issue # .
Return "Fatal error: Class 'stdclass' not found" with php7
Status | New | ⇒ | Pending |
Labels |
Added:
?
|
Category | ⇒ | MS SQL Libraries |
"Fatal error: Class 'stdclass' not found" with php7
hmm if the stdclass can'T be found this sounds like a bigger problem as it is build in the core of php. ?
Can you please add a way to reproduce this error?
Labels |
Added:
?
|
$app = JFactory::getApplication();
//create istance on sqlServer
$dbSqlServer= array();
$dbSqlServer['driver'] = 'sqlsrv';
$dbSqlServer['host'] = '192.168.1.1';
$dbSqlServer['user'] = 'sa';
$dbSqlServer['password'] = 'password';
$dbSqlServer['database'] = 'dbSqlServer';
$dbSqlServer['prefix'] = '';
$app->set('sqlServer', $dbSqlServer);
//then i use first MySql then SqlServer
$dbconenction = $app->get('sqlServer');
$db = JDatabase::getInstance($dbconenction);
//set query .... then i get data...
$db->setQuery('select......');
$items = $db->loadObjectList(); //here get error
Joomla configured on mysql database and this code part is in our module.
If you want, I will send more details next week...
It's still an invalid fix. I know this has come up numerous times, but there is not a core Joomla issue here.
stdClass
is part of the core PHP API. You cannot conceivably run the PHP binary with this missing.
Removing this parameter removes part of the Joomla API's features (supported by all database engines) where you specify the type of object the data is loaded into.
I do not believe there is something we can patch in Joomla to address this issue. As annoying as it is.
I read somewhere that this could be related to a misuse of PHP 5.3 namespaces. stdClass is in the global namespace we possibly need to write $class = '\stdClass' or add a use statement on the top of the file.
Except our code in the libraries/joomla
directory is in the global namespace so that in itself should not be the issue (I'd expect that more with the namespaced Framework code than the code here in the CMS).
Even if it were related to namespaces, usually the error is something like class Joomla\Database\stdclass cannot be found
and would indicate what namespace the class is being searched for in.
Status | Pending | ⇒ | Closed |
Closed_Date | 0000-00-00 00:00:00 | ⇒ | 2017-05-20 12:35:26 |
Closed_By | ⇒ | brianteeman |
This isn't a valid fix, actually it breaks one of the API features.