Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:82174 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 52300 invoked from network); 8 Feb 2015 21:09:52 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 8 Feb 2015 21:09:52 -0000 Authentication-Results: pb1.pair.com header.from=ajf@ajf.me; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ajf@ajf.me; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain ajf.me designates 192.64.116.216 as permitted sender) X-PHP-List-Original-Sender: ajf@ajf.me X-Host-Fingerprint: 192.64.116.216 imap10-3.ox.privateemail.com Received: from [192.64.116.216] ([192.64.116.216:48831] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D1/E4-26926-F90D7D45 for ; Sun, 08 Feb 2015 16:09:52 -0500 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 71AAD2400AA; Sun, 8 Feb 2015 16:09:48 -0500 (EST) X-Virus-Scanned: Debian amavisd-new at imap10.ox.privateemail.com Received: from mail.privateemail.com ([127.0.0.1]) by localhost (imap10.ox.privateemail.com [127.0.0.1]) (amavisd-new, port 10024) with LMTP id heA-sRuJB0Ci; Sun, 8 Feb 2015 16:09:48 -0500 (EST) Received: from oa-res-26-240.wireless.abdn.ac.uk (oa-res-26-240.wireless.abdn.ac.uk [137.50.26.240]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 9606E2400EE; Sun, 8 Feb 2015 16:09:45 -0500 (EST) Content-Type: text/plain; charset=utf-8 Mime-Version: 1.0 (Mac OS X Mail 8.2 \(2070.6\)) In-Reply-To: <54D7C2CD.7040707@mabe.berlin> Date: Sun, 8 Feb 2015 21:09:43 +0000 Cc: internals@lists.php.net Content-Transfer-Encoding: quoted-printable Message-ID: <74E307F8-6E5B-4CA6-8639-A3D89FF63A87@ajf.me> References: <54D7C2CD.7040707@mabe.berlin> To: Marc Bennewitz X-Mailer: Apple Mail (2.2070.6) Subject: Re: [PHP-DEV] PHP6 artifact - binary strings From: ajf@ajf.me (Andrea Faulds) Hi, > On 8 Feb 2015, at 20:10, Marc Bennewitz wrote: >=20 > Since PHP-5.2.1 we have an artifact of PHP-6 in the engine means we = can define binary strings but such definitions haven't any effect. Yes. That=E2=80=99s because PHP 6 was going to have Unicode strings by = default, alongside binary strings (to PHP 5 and 7, just =E2=80=9Cstrings=E2= =80=9D). These =E2=80=9Cbinary strings=E2=80=9D are just strings. > So what we can define is the following: >=20 > $str =3D "str"; > $bin =3D b"b\0i\0n"; > $str2bin =3D (binary)$str; >=20 > One of the biggest issue is that currently ALL strings will be handled = as ASCII-7 compatible strings on type-juggling but they aren=E2=80=99t. In the rare case you need to prevent type juggling of binary data, you = could wrap it in an object. > It would be very appreciated if PHP could respect such binary = declaration: >=20 > * use binary string comparison on compare a binary string to any other = string > * don't convert binary strings into integers on array keys > * allow bitwise operators on binary strings without casting to integer This would break existing code which was made =E2=80=9CPHP 6-ready=E2=80=9D= . Also, we already support bitwise operations on strings, I don=E2=80=99t = know what you=E2=80=99re on about there... -- Andrea Faulds http://ajf.me/