#41549 [Opn->Bgs]: Object to String convert
ID: 41549
Updated by: johannes@php.net
Reported By: nikolai dot essel at maxworx dot com
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Windows XP SP2
PHP Version: 5.2.2
New Comment:
Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php
.
Previous Comments:
------------------------------------------------------------------------
[2007-05-31 13:02:07] nikolai dot essel at maxworx dot com
Description:
------------
After updating from PHP 5.1.6 some scripts didn´t work.
Problem is the standard behavior from casting objects into strings
without an explicit defined __toString() method
Reproduce code:
---------------
<?php
class test
{
private $var = "test";
public function __construct() {}
}
$object = new test();
echo $object;
?>
Expected result:
----------------
Object id #1
Actual result:
--------------
Catchable fatal error: Object of class test could not be converted to
string in C:\xampp\htdocs\classtest.php on line 9
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=41549&edit=1
Thread (3 messages)