Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:65945 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 49604 invoked from network); 19 Feb 2013 13:30:09 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Feb 2013 13:30:09 -0000 Authentication-Results: pb1.pair.com header.from=nikita.ppv@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=nikita.ppv@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.179 as permitted sender) X-PHP-List-Original-Sender: nikita.ppv@gmail.com X-Host-Fingerprint: 209.85.214.179 mail-ob0-f179.google.com Received: from [209.85.214.179] ([209.85.214.179:52917] helo=mail-ob0-f179.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 24/D5-17768-F5E73215 for ; Tue, 19 Feb 2013 08:30:08 -0500 Received: by mail-ob0-f179.google.com with SMTP id un3so6541152obb.24 for ; Tue, 19 Feb 2013 05:30:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=BvdjklaftOCKBsJIHUoUtXK/DjtjNxIzEWiP/VbMPoc=; b=PnKOaBY+kFnF1CkyUFrYccHXV+srDCfLqIKu5iXRQfncu1wjbEW4vhSr/j114cxq8O GQvtLb8A6Snc2jzcJhj5FcUcEMZAY30yzB4SqnUXcgDVpPpYW6zJe6OenFqG0WL3peip GscmuGiUnWY5+O+TSNx5TOvPiuNJWBlbGSa61NdYb8ZcS9vfF1EC/bdE/mfHUsNwQf1M E5lj+DIAg6eKHdpyutfb3EP3gqfSk5+gSkiX03lOWu1WCzcniE0aL5kHTGey84kWjsMg mVI8uCPfe/EueVYkoASHIush8ZkWVfGiq73e4UtOiuhzJesSgSMCd5LQjQar5b+nzdza ZLOg== MIME-Version: 1.0 X-Received: by 10.60.170.44 with SMTP id aj12mr7442006oec.42.1361280605531; Tue, 19 Feb 2013 05:30:05 -0800 (PST) Received: by 10.182.49.136 with HTTP; Tue, 19 Feb 2013 05:30:05 -0800 (PST) In-Reply-To: References: Date: Tue, 19 Feb 2013 14:30:05 +0100 Message-ID: To: Derick Rethans Cc: PHP internals Content-Type: multipart/alternative; boundary=bcaec54d475ceeaf2b04d613d692 Subject: Re: [PHP-DEV] [RFC] Allow non-scalar keys in foreach From: nikita.ppv@gmail.com (Nikita Popov) --bcaec54d475ceeaf2b04d613d692 Content-Type: text/plain; charset=ISO-8859-1 On Tue, Feb 19, 2013 at 2:25 PM, Derick Rethans wrote: > On Tue, 19 Feb 2013, Nikita Popov wrote: > > > This RFC proposes to remove the type-restrictions on Iterator keys > > used in foreach: > > > > https://wiki.php.net/rfc/foreach-non-scalar-keys > > > > I took over Levi's RFC and added a patch for it. > > Under "Open Questions" you write: > > > What should be done with the keys that are valid in the iterator, but > not in > > the array? I think the best approach would be to just set the array keys > with > > the exact same semantics as PHP would do (i.e. with all casts and > warnings). > > Would __toString be called in case the key was an object? > Current behavior of PHP can be found here: http://lxr.php.net/xref/PHP_TRUNK/Zend/zend_execute.c#996 So if one goes with that approach, then no, __toString won't be called, it'll throw a "* Warning*: Illegal offset type" and not set the key. Don't know whether that's good or bad ^^ Nikita --bcaec54d475ceeaf2b04d613d692--