Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:8881 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 25589 invoked by uid 1010); 1 Apr 2004 23:36:51 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 25565 invoked from network); 1 Apr 2004 23:36:50 -0000 Received: from unknown (HELO shiva.mind.de) (212.42.230.204) by pb1.pair.com with SMTP; 1 Apr 2004 23:36:50 -0000 Received: from [192.168.1.105] (p508EA7B6.dip.t-dialin.net [80.142.167.182]) by shiva.mind.de (Postfix) with ESMTP id 8CC9597B4F; Fri, 2 Apr 2004 01:36:49 +0200 (CEST) Date: Fri, 2 Apr 2004 01:37:13 +0200 Reply-To: Marcus Boerger X-Priority: 3 (Normal) Message-ID: <57977140562.20040402013713@marcus-boerger.de> To: David Giffin Cc: internals@lists.php.net In-Reply-To: References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] __toString() with cast is broken in php5 RC1 From: helly@php.net (Marcus Boerger) Hello David, that's correct. See the NEWS file, 3rd entry: 18 March 2004, PHP 5 Release Candidate 1 - Fixed numerous bugs with the just-in-time auto-global initialization, that could cause $_SERVER, $argv/$argc and other variables not to work properly. (Zeev) - Fixed data corruption with constant assignments to object properties. (Zeev) - Changed __toString() to be called automatically only with print and echo statements. (Andi) Friday, April 2, 2004, 1:13:28 AM, you wrote: > Hi There, > I just got a chance tp update to PHP5 RC1 and noticed that some things > have changed for the __toString method. It seems that it it only getting > called when the object is printed or echo. Casting the object to a string > returns the Object #. Here is an example: > ---- The Script: > class obj > { > function __toString() > { > return "yo!!\n"; > } > } > $obj = new obj(); > print_r($obj); > $test = (string) $obj; > print $test; > print $obj; ?>> > ----- Produces: > obj Object > ( > ) > Object id #1yo!! > Thanks, > David -- Best regards, Marcus mailto:helly@php.net