ID:               34079
 Updated by:       [EMAIL PROTECTED]
 Reported By:      mbneto at gmail dot com
-Status:           Open
+Status:           Bogus
 Bug Type:         Class/Object related
 Operating System: Linux
 PHP Version:      5.1.0b3
 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:
------------------------------------------------------------------------

[2005-08-11 04:50:01] mbneto at gmail dot com

Description:
------------
When using a echo/print with an object that has a __toString method
defined it behaves strange depending on the usage.

echo $obj is fine
echo $obj."\n"  is not

Reproduce code:
---------------
class TestClass
{
   public $foo;

   public function __construct($foo) {
       $this->foo = $foo;
   }

   public function __toString() {
       return $this->foo;
   }
}

$n = new TestClass("test") ;
echo $n ;   // works - shows test
echo $n."\n" ;  // does not - show Object id #1

Expected result:
----------------
Test

Actual result:
--------------
Object id #1


------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=34079&edit=1

Reply via email to