ID:               30421
 User updated by:  melnikow at hotbox dot ru
 Reported By:      melnikow at hotbox dot ru
-Status:           Bogus
+Status:           Open
 Bug Type:         Feature/Change Request
 Operating System: WinXP
 PHP Version:      5.0.1
 New Comment:

// A construction 
echo $obj; 
// realy works as expected and the output is a string: What ever

// But using this object in string context or explicit
// type casting (string) return unexpected result:
echo "Any string $obj";
// Output: Any string Object id #1


Previous Comments:
------------------------------------------------------------------------

[2004-10-14 07:58:14] [EMAIL PROTECTED]

Still works as expected:

[EMAIL PROTECTED]:~$ php-5.0dev bug30421.php

What ever


[EMAIL PROTECTED]:~$ php-5.0dev -v bug30421.php

PHP 5.0.2-dev (cli) (built: Sep 12 2004 11:50:47) (DEBUG)
Copyright (c) 1997-2004 The PHP Group
Zend Engine v2.0.2-dev, Copyright (c) 1998-2004 Zend Technologies


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

[2004-10-13 18:22:59] melnikow at hotbox dot ru

Sorry, assumes that

$obj = new Foo();

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

[2004-10-13 10:17:50] [EMAIL PROTECTED]

Your script is bogus:
Notice: Use of undefined constant Foo - assumed 'Foo' in - on line 8



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

[2004-10-13 10:08:06] melnikow at hotbox dot ru

Description:
------------
The new __toString() magic method wont work

Reproduce code:
---------------
The new __toString() magic method allows you to overload the object to
string conversion:
<?php 
class Foo { 
   function __toString() { 
       return "What ever"; 
   } 
} 

$obj = Foo; 
$str = (string) $obj; // call __toString() 
echo $obj; // call __toString() 
?> 

Expected result:
----------------
What ever

Actual result:
--------------
Object#n


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


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

Reply via email to