Integer::__toString() must return a string #16

Closed
mgrandi opened this Issue May 30, 2011 · 2 comments

2 participants

@mgrandi

The following code:

http://pastebin.com/TxCqKzPt

has the following output:

hello
test
mongo is: localhost:27018
db is: MyDatabase
creating storage
error_reporting() returns: 22527
created storage
a book saved with id: 4de33f7409b35d4b38000002
 Catchable fatal error: Method morph\property\Integer::__toString() must return a string value in phar:///var/www/morphtest/Morph.phar/Object.php on line 190

the line that throws it (in the pastebin code i provided ) is line 59. It seems you can print out the properties of the object once you get it out of the database, but if you try to print the object you get this.

@a-musing-moose

Hi Mark,

Thanks for the letting me know. I have updated the code so that __toString will now work correctly for integer fields.

@mgrandi

I think more classes have this problem. When i try to print out a class i got from the database with a date field, i get this:

[Tue May 31 00:59:04 2011] [error] [client 192.168.1.107] PHP Catchable fatal error: Method morph\property\Date::__toString() must return a string value in phar:///var/www/contacts/Morph.phar/Object.php on line 190

with the code: http://pastebin.com/APMwq2dT

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment