Bei Problem mit To-String konvertierung der Joomla Beta 1.5

Hi,

Wenn ihr nach der Installation der Joomla Beta 1.5 Version Probleme habt und ein Fehler mit der Meldung “Object of class stdClass could not be converted to string” kommt müsst ihr unter http://dev.joomla.org/content/view/17/60/#nightly gehen und Option Nightly Builds wählen.

Mit dieser Option klappt es, der Fehler tritt aber nur auf wenn man PHP 5.2.0 hat oder höher. Grund dafür ist folgende änderung in PHP 5.2 zu 5.1 und früheren Version von PHP:

– Changed __toString to be called wherever applicable. (Marcus)

The magic method __toString() will now be called in a string context, that
is, anywhere an object is used as a string. When implementing your __toString()
method in a class, you should be aware that the script will terminate if
your function throws an exception.

The PHP 5.0/5.1 fallback – returning a string that contains the object
identifier – has been dropped in PHP 5.2. It became problematic because
an object identifier cannot be considered unique. This change will mean
that your application is flawed if you have relied on the object identifier
as a return value. An attempt to use that value as a string will now result
in a catchable fatal error (see above).

Even with __toString(), objects cannot be used as array indices or keys. We
may add built-in hash support for this at a later date, but for PHP 5.2 you
will need to either provide your own hashing or use the new SPL function
spl_object_hash().

Leave a Reply

Your email address will not be published. Required fields are marked *