Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:53424 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 27007 invoked from network); 20 Jun 2011 16:34:26 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 20 Jun 2011 16:34:26 -0000 Authentication-Results: pb1.pair.com header.from=johncrenshaw@priacta.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=johncrenshaw@priacta.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain priacta.com designates 64.95.72.238 as permitted sender) X-PHP-List-Original-Sender: johncrenshaw@priacta.com X-Host-Fingerprint: 64.95.72.238 mx1.myoutlookonline.com Received: from [64.95.72.238] ([64.95.72.238:52861] helo=mx1.myoutlookonline.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id E8/6B-34681-F867FFD4 for ; Mon, 20 Jun 2011 12:34:25 -0400 Received: from mxout.myoutlookonline.com (localhost [127.0.0.1]) by mx1.myoutlookonline.com (Postfix) with ESMTP id 42A7D417C8B; Mon, 20 Jun 2011 12:34:20 -0400 (EDT) X-Virus-Scanned: by SpamTitan at mail.lan Received: from HUB028.mail.lan (unknown [10.110.2.1]) by mx1.myoutlookonline.com (Postfix) with ESMTP id 4AD2041755D; Mon, 20 Jun 2011 05:45:57 -0400 (EDT) Received: from MAILR001.mail.lan ([10.110.18.27]) by HUB028.mail.lan ([10.110.17.28]) with mapi; Mon, 20 Jun 2011 12:14:39 -0400 To: Ilia Alshanetsky , Robert Eisele CC: "internals@lists.php.net" Date: Mon, 20 Jun 2011 12:15:36 -0400 Thread-Topic: [PHP-DEV] foreach() for strings Thread-Index: AcwvXnBjQ15FqMFGQbmsGHMBJD5zyAAAIOIg Message-ID: References: In-Reply-To: Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: acceptlanguage: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable MIME-Version: 1.0 Subject: RE: [PHP-DEV] foreach() for strings From: johncrenshaw@priacta.com (John Crenshaw) > From: Ilia Alshanetsky [mailto:ilia@prohost.org]=20 >=20 > As long as it works on a premise that a "string" is a byte array and > each element represents 1 byte, +1 from me. Code written on this premise is almost always bug central when people final= ly get around to realizing why they really do need to support wide characte= rs (and everybody does, because people like to paste stuff containing non-b= reak-spaces, and decorative quotes). I really don't think this single byte = character mentality should be encouraged. Also, how do you think this will work with the Unicode conversion in PHP 6?= Guaranteed, this will break stuff. Some people will have written code to i= terate characters, assuming single byte characters, some people will have w= ritten code ACTUALLY intending to iterate as a byte array. Sadly, we can al= most certainly assume that the single byte characters assumption (which is = wrong) will also be, by far, the most common. Supporting that most common c= ase when moving to PHP 6 would require breaking the binary case (which was = the only properly written code in the first place.) On the other hand, supp= orting the binary case means breaking the most common case. John Crenshaw Priacta, Inc.