Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77559 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 77943 invoked from network); 24 Sep 2014 00:08:37 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Sep 2014 00:08:37 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@sugarcrm.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@sugarcrm.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain sugarcrm.com designates 108.166.43.75 as permitted sender) X-PHP-List-Original-Sender: smalyshev@sugarcrm.com X-Host-Fingerprint: 108.166.43.75 smtp75.ord1c.emailsrvr.com Linux 2.6 Received: from [108.166.43.75] ([108.166.43.75:40790] helo=smtp75.ord1c.emailsrvr.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id F5/80-02052-48B02245 for ; Tue, 23 Sep 2014 20:08:37 -0400 Received: from localhost (localhost.localdomain [127.0.0.1]) by smtp10.relay.ord1c.emailsrvr.com (SMTP Server) with ESMTP id EEF333804A5; Tue, 23 Sep 2014 20:08:33 -0400 (EDT) X-Virus-Scanned: OK Received: by smtp10.relay.ord1c.emailsrvr.com (Authenticated sender: smalyshev-AT-sugarcrm.com) with ESMTPSA id 854DA38047E; Tue, 23 Sep 2014 20:08:33 -0400 (EDT) X-Sender-Id: smalyshev@sugarcrm.com Received: from Stass-MacBook-Pro.local (108-66-6-48.lightspeed.sntcca.sbcglobal.net [108.66.6.48]) (using TLSv1.2 with cipher DHE-RSA-AES128-SHA) by 0.0.0.0:465 (trex/5.2.13); Wed, 24 Sep 2014 00:08:33 GMT Message-ID: <54220B80.5050208@sugarcrm.com> Date: Tue, 23 Sep 2014 17:08:32 -0700 Organization: SugarCRM User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.7; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: Florian Margaine , Michael Wallner CC: PHP Internals References: <54213481.8080700@php.net> <54213ECC.5080204@php.net> <54214E57.3080200@php.net> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Invokation on __toString() for object used as array key From: smalyshev@sugarcrm.com (Stas Malyshev) Hi! > I do believe that the UString class would benefit from such a change. > > Why would it be confusing to implement this? For some objects, it may lead to rather strange results - i.e., Exception has __toString() but probably not very useful one for use as an array key. So may some other __toString methods. But in general, if we streamline the conversion rules and set expectations, I don't see why PHP engine can not check for object's convertor to string and even to int if string one is not there. Yes, that would hide some errors but also will enable some capabilities (like much smoother work with objects that may simulate numbers, akin to GMP). -- Stanislav Malyshev, Software Architect SugarCRM: http://www.sugarcrm.com/