Object of class stdClass could not be converted to int

I have an image hosting website and when I transferred my site to a different server, I got this message on my website

Notice: Object of class stdClass could not be converted to int in /home/pix/public_html/includes/config.inc.php on line 35

Can someone explain what the message above meant? What do I need to do to fix it? Thanks


Can you tell the version numbers for your previous and current MySQL / PHP installations? Did the move include an upgrade of the hosting software?

Could you also post the line of code causing the error?

Previous database
PHP version 5.2.5
MySQL version 4.0.27-standard

Current database:
PHP version 5.2.5
MySQL version 4.0.27-standard

I don’t see any difference between the two mySQL/PHP info

I moved the site to a completely different webhost from “reseller” to “vps”

I hope that answers all of your questions

This is the line

if( $config == 0 || $config->installed == 0 ){

“$config == 0” is the problem
$config contains an object not an integer so PHP tries to convert it into an integer but it can’t hence the error.

Now why you are getting the error now is either because the error_reporting was turned off or notices were ignored in the old server.

Fix the problem yeah, or turn error_reporting off/turn it down for the time being just to get your site working again.

Perfect! you guys rock! thanks for your help

Please forgive my ignorance but how do you turn off notices? How did you actually correct this problem, I have the same exact issue. Thanks all.

Does this help:


Thank you, yes, it helped.

Problem was that the software was zend encoded. In the unencoded version I was able to see that error reporting was on. It was not a problem with the php.ini but it was the code itself. Seeing the above information I set the error reporting to (0) and I no longer see the errors.

So would you say you are still having the error message above, or you have stopped the error message and you application works fine?

Do you understand what the error message above is saying, or do you need help with comprehension?

I think I have lost exactly what it is you need assistance with. Sorry for being so dense.

If logic_earth is correct then surely a better condition needs to be there:

Something like:

//$config = new stdClass;
//$config->installed = 0;

if( !isset( $config ) || !isset( $config->installed )  || $config->installed == 0) {
echo 'config not set' ;

which fails when :
$config is not set
if $config is set but $config->installed is not set
if $config is set and $config->installed is set, but set to zero