Reply to Re: i got error to make a class object

Re: i got error to make a class object new!
by colin, 17 years ago
Apparently, it is an issue with PHP 5.2;

As of (at least) PHP 5.2, you can no longer convert an object to a string unless it has a __toString method. Converting an object without this method now gives the error: Object of class could not be converted to string in <file> on line <line>

I have PHP 5.2.3 here, but the class works fine. However, if I do the following at the command line, I have the problem:
$ php -r "echo PHP_VERSION; echo new StdClass;"
5.2.3-1ubuntu6
Catchable fatal error: Object of class stdClass could not be converted to string in Command line code on line 1

What are the lines before and after your line 13? Also, which version of the class are you using?Reply

Your reply

Name *
Email 
Title *
Text *
CAPTCHA image
Enter the code displayed on the image:
Click on the image to generate another one if it is hard to read it. The case is important