Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:77521 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 80237 invoked from network); 23 Sep 2014 09:45:30 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 23 Sep 2014 09:45:30 -0000 Authentication-Results: pb1.pair.com smtp.mail=leight@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=leight@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.212.178 as permitted sender) X-PHP-List-Original-Sender: leight@gmail.com X-Host-Fingerprint: 209.85.212.178 mail-wi0-f178.google.com Received: from [209.85.212.178] ([209.85.212.178:56835] helo=mail-wi0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CD/5C-09206-93141245 for ; Tue, 23 Sep 2014 05:45:30 -0400 Received: by mail-wi0-f178.google.com with SMTP id z2so4638554wiv.11 for ; Tue, 23 Sep 2014 02:45:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc:content-type; bh=KiyqlBvXUnRMJ33yKwDXL7kGYlbfiOzsfzr3p32KF9I=; b=cVvBLSQRtk3CnZ2mdECK22E7cSG5bs2WnJJqfLj7QO3JD48Cv2gmkQ0k8VhGHRuGz6 AqdxN1VI6oa70Hk946rDs42GLwZrkEiogsv5OAErJCK7xNo7g4wqLoUVBmWd+erDDSb8 9taZY0IAiG+Semt1GRJ2XMnomkgljigCOO7e2czRi+1CEpZKyGaO6RejXfh1MPnqQ0TI X+rOulTzXjFKI60u0Ptcr5tRc/ETkD80wPhwG8vwiY3i3AHRvPViEnJU1A8iyBdWRFFg vnzFVSkc4ZSgnpfk7tAbtJL0wtOWdFQxB70Ts4+wOqg4PG+SMFZbPcwegURcoyhjkHUS ZrZw== MIME-Version: 1.0 X-Received: by 10.180.206.230 with SMTP id lr6mr1952298wic.82.1411465526829; Tue, 23 Sep 2014 02:45:26 -0700 (PDT) Received: by 10.217.55.195 with HTTP; Tue, 23 Sep 2014 02:45:26 -0700 (PDT) In-Reply-To: <54213ECC.5080204@php.net> References: <54213481.8080700@php.net> <54213ECC.5080204@php.net> Date: Tue, 23 Sep 2014 10:45:26 +0100 Message-ID: To: Michael Wallner Cc: Nicolai Scheer , PHP Internals Content-Type: text/plain; charset=UTF-8 Subject: Re: [PHP-DEV] Invokation on __toString() for object used as array key From: leight@gmail.com (Leigh) On 23 September 2014 10:35, Michael Wallner wrote: > On 2014-09-23 11:15, Leigh wrote: >> He doesn't want to add the object as a key, he wants to invoke __toString(). > > Did I write that? No, you didn't, sorry. I just didn't see how an object with an explicit method to convert it to a string compared to using a resource straight up as a key. If you were implying the resource would be cast to int, then I get the comparison. Does it really make bugs that hard to find? You'd expect the user to know when they're using this behaviour when they write the code... well, I would. I suppose explicit casting removes any ambiguity, we use $a[(int)$resource] all the time for arrays of sockets and that's served us fine over the years. Hmm, thinking about it $a[(string)$object] is a lot clearer than having some magic sort it out. You're right, I'll retreat now :)