NYCPHP Meetup

NYPHP.org

[nycphp-talk] PHP 5.3 Problem - Object Creation problem

Jake McGraw jmcgraw1 at gmail.com
Tue Aug 21 10:01:14 EDT 2007


Create a public __toString() function within your Database class. It can be
something as simple as:

public function __toString() {
  return 'Object';
}

This is a new as of 5.2 - for some reason they've removed implicit
object-to-string conversion. You must provide explicit __toString if you're
printing or concatenating your objects.

- jake

On 8/21/07, jeff mailings <jeffmailings99 at verizon.net> wrote:
>
> Anyone know the best way to handle this error? "PHP Catchable fatal error:
> Object of class Database could not be converted to string"
>
> I've got some old class modules that I'm trying to run under PHP 5.3.
>
>
> Jeff Siegel
>
>
> _______________________________________________
> New York PHP Community Talk Mailing List
> http://lists.nyphp.org/mailman/listinfo/talk
>
> NYPHPCon 2006 Presentations Online
> http://www.nyphpcon.com
>
> Show Your Participation in New York PHP
> http://www.nyphp.org/show_participation.php
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.nyphp.org/pipermail/talk/attachments/20070821/18f935e8/attachment.html>


More information about the talk mailing list