Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:94363 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 35740 invoked from network); 3 Jul 2016 00:00:35 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 3 Jul 2016 00:00:35 -0000 Authentication-Results: pb1.pair.com header.from=smalyshev@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=smalyshev@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.218.42 as permitted sender) X-PHP-List-Original-Sender: smalyshev@gmail.com X-Host-Fingerprint: 209.85.218.42 mail-oi0-f42.google.com Received: from [209.85.218.42] ([209.85.218.42:36153] helo=mail-oi0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E3/F4-28154-2A558775 for ; Sat, 02 Jul 2016 20:00:35 -0400 Received: by mail-oi0-f42.google.com with SMTP id f189so155408984oig.3 for ; Sat, 02 Jul 2016 17:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:to:references:from:message-id:date:user-agent:mime-version :in-reply-to:content-transfer-encoding; bh=whvNUFySZFMWeYENlR2ER67yW8tA94C1REkRK8pW6V8=; b=EKAjU8/fUAXMJElr5gKS4rws8lKQS++7u3CkmN1VWONhBJVOnXKhVWWnCnj7Zrg5Z9 KKGUtcQmERsK9JdVWbhwgt6Q8Z9yXONyEou/w1h3b8HW7u1QGjMe9bi5iqCPgLmDqQKN CyW57sw64N3ZXurIZICBKdgFFztAhA3JjZZjHTxSTcVr8IOeGEu2UM4aboEOVPorNqFk Copv8rjHG0997/Mp3ohDQkBY/Sce8Ir0eDLZbYKE5N3NdhMjHM9x1sabdSsfuTbO6A+P R5D/E6bxHV0QUE5tGuuIEbC5wW5Ft6WtnmKbjxezWfQ2W8fzLqxj9X7IEtpK2XDMCCUp Wq9A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:subject:to:references:from:message-id:date :user-agent:mime-version:in-reply-to:content-transfer-encoding; bh=whvNUFySZFMWeYENlR2ER67yW8tA94C1REkRK8pW6V8=; b=OxGnAq+Mg8Y4R82HGC806vLSLm1zqydn7DdjjL5ko6l1s8/Tmyi+ijzCVuUB952kr7 PbpOcC1W1Tzlj24VV5mTq6U36MdA/246vAV8ZLGq12IG87R43SvV8AOEOaB8YRZTzrqC DMLkRscKlR1JL0a9RSmcBjbJl4Yzqm/i4IVcrfPiImPYUE6LeARTOvnaLH9gs15rzX8i MK7bOVJtyExRsUmGq8+DEQQ9ObAN3ZGxTT772BcQD33mqEjV6VyHIvDZ20yKSgPhbFbw k8c7w5hF0VCG166qpT0LvlaZM61iW0tmXkv64RPA3cAtgs/ebJufowj8LKh/G9EOAwex qHqw== X-Gm-Message-State: ALyK8tKop2UQciqUUuv0xPeTvNMKTzxhG5kgT/LKEDNwpfKxsOWKmz/5Hvp/k2dCyObJqQ== X-Received: by 10.202.241.68 with SMTP id p65mr3253235oih.187.1467504031466; Sat, 02 Jul 2016 17:00:31 -0700 (PDT) Received: from ?IPv6:2602:304:cdc2:e5f0:a593:46a1:fec:1cf6? ([2602:304:cdc2:e5f0:a593:46a1:fec:1cf6]) by smtp.gmail.com with ESMTPSA id r62sm8293531oia.25.2016.07.02.17.00.30 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sat, 02 Jul 2016 17:00:30 -0700 (PDT) To: Aaron Piotrowski , Jeremy Mikola , PHP internals References: <8284FE1F-70EE-4DB6-A945-0C57A4C99DCC@trowski.com> <16ef864f-8378-1af3-ddfb-21dc583a4b4a@gmx.de> <35132CB5-6E11-477F-8AC6-4374A7434D43@trowski.com> Message-ID: <20f10295-5c09-853c-3a54-d8c1b20f3684@gmail.com> Date: Sat, 2 Jul 2016 17:00:24 -0700 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:45.0) Gecko/20100101 Thunderbird/45.1.1 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] [RFC] Iterable From: smalyshev@gmail.com (Stanislav Malyshev) Hi! > Generally when I've seen an object that did not implement Traversable > used with foreach it has been an error. The exception of course is > stdClass, particularly because of json_decode(). There was no > discussion on the list of allowing stdClass, but I did discuss it > with some people in chat. Our consensus was that a casting to an > array was a reasonable and simple requirement to allow an instance of > stdClass to be iterable. I do not think stdClass was designed for I'm not sure I understand this part. Do you mean that this code: $a = json_decode('{"a": 1, "b": 2, "c": 3}'); foreach($a as $b) { var_dump($b); } will no longer work, or that it will still work, but stdClass would not be instanceof Iterable? -- Stas Malyshev smalyshev@gmail.com