I got this error from CI.
Environment
IIS 10
PHP 7.0.16
I solved this problem changing the line 183 of mysqli_result.php to
protected function _fetch_object($class_name = '\stdClass')
nice
Please explain how you managed to trigger this first.
There's at least 2 reasons why it doesn't make sense:
A string class name is always interpreted as an absolute (i.e. namespaces included) class path by PHP. In other words, the leading namespace separator is assumed/irrelevant for string class names (as well as in use statements). If this is somehow not the case in some MySQLi function - then it would be a PHP bug.
This is easily testable:
$ php -r "namespace Dummy { var_dump(class_exists('stdClass')); }"
Command line code:1:
bool(true)
CI_DB_mysqli_result is not declared inside a namespace. Thus, even if the former point wasn't true, 'stdClass' would still resolve to \stdClass when relatively searched for, as both classes reside in the root namespace.
Also, linking #5043.
Most helpful comment
Please explain how you managed to trigger this first.
There's at least 2 reasons why it doesn't make sense:
A string class name is always interpreted as an absolute (i.e. namespaces included) class path by PHP. In other words, the leading namespace separator is assumed/irrelevant for string class names (as well as in
usestatements). If this is somehow not the case in someMySQLifunction - then it would be a PHP bug.This is easily testable:
CI_DB_mysqli_resultis not declared inside a namespace. Thus, even if the former point wasn't true, 'stdClass' would still resolve to\stdClasswhen relatively searched for, as both classes reside in the root namespace.Also, linking #5043.