PHP 5 introduces the E_STRICT error reporting constant. The PHP manual states "Enable to have PHP suggest changes to your code which will ensure the best interoperability and forward compatibility of your code.". Thus it's recommendable to enable strict PHP errors.
Enabling the strict mode is done via the INI file (php.ini) or via code during runtime:
ini_set('error_reporting', E_ALL | E_STRICT);
The above code sets error_reporting to E_ALL and E_STRICT, because E_STRICT is not part of the E_ALL constant.
Disabling the strict mode works vice versa:
ini_set('error_reporting', E_ALL);
This error tells you your code instantiated a default object (of type stdClass) implicitely. The referenced part of your code most likely looks like
$object->foo = 'bar';
PHP is strict and doesn't accept this, because you didn't create the $object explicitely! The solution to this is rather simple: add the explicit instantiation and you're done! The code should look like:
$object = new stdClass(); // instantiate $object explicitely $object->foo = 'bar'; // now it's save to do this!
YAY! Thanks for this, you are
YAY! Thanks for this, you are a legend :)
I was getting an error in Bumble-Bee v1.15:
"Strict Standards: Creating default object from empty value in /path/to/folder/bumble-bee/system-inc/php-gettext/gettext.inc on line 152"
Fixed by adding at line 152:
$text_domains[$domain] = new stdClass();
Woohooo!
Thanks! This post helps me.
Thanks! This post helps me.
Post new comment