Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77566 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 12500 invoked from network); 24 Sep 2014 05:57:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 24 Sep 2014 05:57:52 -0000 Authentication-Results: pb1.pair.com smtp.mail=mike.php.net@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=mike.php.net@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.171 as permitted sender) X-PHP-List-Original-Sender: mike.php.net@gmail.com X-Host-Fingerprint: 209.85.212.171 mail-wi0-f171.google.com Received: from [209.85.212.171] ([209.85.212.171:49926] helo=mail-wi0-f171.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1B/90-03797-06D52245 for ; Wed, 24 Sep 2014 01:57:52 -0400 Received: by mail-wi0-f171.google.com with SMTP id ho1so6192685wib.4 for ; Tue, 23 Sep 2014 22:57:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:message-id:date:from:user-agent:mime-version:to:cc:subject :references:in-reply-to:content-type:content-transfer-encoding; bh=D4MDikUb6WNcidP9RHIbPKUaqjwgEuckt+0Pi0U+0ZU=; b=cEOVlNepro/kim7aRUG37qFoXHQ9a0htPvhRB1hk0wyVimO+De/IRNLgRWQMLFsNxD OFf5khwNGozb2thPxMJQ+VVSRzvmTOLepP8Q27RA8T9CR4u0klce4KQOffLjOIWB9SRe LqYUj3r/lX1vGfrk+ApiClcHjcxPoyAQl+WYxG124pnoTHotBnf0obHbqnb/IlNw6gaM 5+aNjp+aGSTcIam0PYVQgCUuLl9kmSQGBSMwPvcB79hA83hByl600KnotuRAKMPL604c OpkI5yJjqfWrTSU4p6GufvtV1Hy7YVR/HxQM91Uvfn9wEizDxtMsS/fS4OwPJ+m+WqvB VLnw== X-Received: by 10.194.174.163 with SMTP id bt3mr5461286wjc.4.1411538269442; Tue, 23 Sep 2014 22:57:49 -0700 (PDT) Received: from [192.168.4.120] (178-18-170-101.customer.bnet.at. [178.18.170.101]) by mx.google.com with ESMTPSA id ek8sm4524841wib.23.2014.09.23.22.57.48 for (version=TLSv1.2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 23 Sep 2014 22:57:48 -0700 (PDT) Sender: Michael Wallner Message-ID: <54225D5B.3030402@php.net> Date: Wed, 24 Sep 2014 07:57:47 +0200 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.1.1 MIME-Version: 1.0 To: Stas Malyshev , Florian Margaine CC: PHP Internals References: <54213481.8080700@php.net> <54213ECC.5080204@php.net> <54214E57.3080200@php.net> <54220B80.5050208@sugarcrm.com> In-Reply-To: <54220B80.5050208@sugarcrm.com> 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: mike@php.net (Michael Wallner) On 24/09/14 02:08, Stas Malyshev wrote: > 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). > Well, then let's remove this restriction from resources, too. -- Regards, Mike