Strict Standards: Creating default object from empty value

Ask community to help.

Moderators: Amaradana, TurboPT, TL Developers

Strict Standards: Creating default object from empty value

Postby Amit05 » Wed Aug 19, 2009 7:02 pm

Hi there,
I just installed testlink version 1.8. After installation, when I try to login, I bump into the error message as below:
"Strict Standards: Creating default object from empty value in /opt/lampp/htdocs/testlink/cfg/const.inc.php on line 615"

The page shows nothing else but this. Could you please help.

Regards.
Amit05
TestLink user
 
Posts: 6
Joined: Wed Aug 19, 2009 7:00 pm

Re: Strict Standards: Creating default object from empty val

Postby Amit05 » Thu Aug 20, 2009 9:41 am

Amit05 wrote:Hi there,
I just installed testlink version 1.8. After installation, when I try to login, I bump into the error message as below:
"Strict Standards: Creating default object from empty value in /opt/lampp/htdocs/testlink/cfg/const.inc.php on line 615"

The page shows nothing else but this. Could you please help.

Regards.


Hey Folks.. Any help ??
Amit05
TestLink user
 
Posts: 6
Joined: Wed Aug 19, 2009 7:00 pm

Postby Amit05 » Fri Aug 21, 2009 9:58 am

Finally I could resolve the issue by adding following line at the beginning of the file.

In the file, on 31st line, add the following :
ini_set('error_reporting',E_ALL);

Basically, we are suppressing the warnings that php is giving. This does not solve the root cause of the issue which is explained @http://www.trash-factor.com/content/php-error-creating-default-object-empty-value as below :

PHP Error: Creating default object from empty value
Submitted by trash-master on Thu, 02/05/2009 - 12:38

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.
About strict mode (E_STRICT)

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);

"Creating default object from empty value"

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!


Hope this helps someone. Unfortunately, the Google also failed to provide any pointers and I eventually spent 2 days trying to figure out the solution. Finally, a friend helped me out.
Amit05
TestLink user
 
Posts: 6
Joined: Wed Aug 19, 2009 7:00 pm

Re: Strict Standards: Creating default object from empty val

Postby sn82w » Wed Aug 01, 2012 6:42 am

Hi, am also facing the issue in testlink
Warning: Creating default object from empty value in C:\xampp\htdocs\testlink\config.inc.php on line 558

Warning: Creating default object from empty value in C:\xampp\htdocs\testlink\config.inc.php on line 565

Warning: Creating default object from empty value in C:\xampp\htdocs\testlink\config.inc.php on line 580

Warning: Creating default object from empty value in C:\xampp\htdocs\testlink\config.inc.php on line 621

Warning: Creating default object from empty value in C:\xampp\htdocs\testlink\config.inc.php on line 624

Warning: Creating default object from empty value in C:\xampp\htdocs\testlink\config.inc.php on line 627

Warning: Creating default object from empty value in C:\xampp\htdocs\testlink\config.inc.php on line 631

Warning: Creating default object from empty value in C:\xampp\htdocs\testlink\config.inc.php on line 640

Warning: Creating default object from empty value in C:\xampp\htdocs\testlink\config.inc.php on line 697

Not able to get any page.
Please give me some solutions to resolve this ..
thanks in advance.
sn82w
Advanced user
 
Posts: 45
Joined: Fri Apr 27, 2012 6:38 pm

Re: Strict Standards: Creating default object from empty val

Postby fman » Wed Aug 01, 2012 1:38 pm

very bad practice post on TWO areas of forum, you are not getting more help this way, but risking that your user will be banned
fman
Member of TestLink Community
 
Posts: 3063
Joined: Tue Nov 15, 2005 7:19 am


Return to Installation and configuration



Who is online

Users browsing this forum: No registered users and 5 guests

cron