Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76257 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 56782 invoked from network); 30 Jul 2014 02:44:15 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jul 2014 02:44:15 -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:49998] helo=imap10-3.ox.privateemail.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id CD/53-29261-EFB58D35 for ; Tue, 29 Jul 2014 22:44:14 -0400 Received: from localhost (localhost [127.0.0.1]) by mail.privateemail.com (Postfix) with ESMTP id 7D0F72400C3; Tue, 29 Jul 2014 22:44:25 -0400 (EDT) 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 kzIfAgHrz6HZ; Tue, 29 Jul 2014 22:44:25 -0400 (EDT) Received: from [192.168.0.15] (unknown [90.210.122.167]) (using TLSv1 with cipher ECDHE-RSA-AES256-SHA (256/256 bits)) (No client certificate requested) by mail.privateemail.com (Postfix) with ESMTPSA id 8132F2400C2; Tue, 29 Jul 2014 22:44:22 -0400 (EDT) Content-Type: text/plain; charset=windows-1252 Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) In-Reply-To: Date: Wed, 30 Jul 2014 03:44:20 +0100 Cc: "internals@lists.php.net" Content-Transfer-Encoding: quoted-printable Message-ID: <5CAE8790-CE0F-480E-A115-D13558777B7F@ajf.me> References: To: Yasuo Ohgaki X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] signed long hash index for PHP7? From: ajf@ajf.me (Andrea Faulds) On 30 Jul 2014, at 03:37, Yasuo Ohgaki wrote: > Current Zend hash uses ulong for numeric array indexes. > This causes bug #67693 >=20 > https://bugs.php.net/bug.php?id=3D67693 >=20 > Signed/unsigned mismatch is the root cause of this bug. > Since PHP's int is signed by default, it might be better > to change Zend hash index to signed long. >=20 > I would like to hear comments who understand Zend internals. If there = aren't > issues, we may have signed long index for PHP7. I noticed this myself (and am currently figuring out how to deal with = it) while implementing bigints in phpng (see my draft RFC for that). = Converting from long to ulong and letting the sign just change is = madness, I=92d fully support a move to signed longs. This would at least = mean that integer casting is the same as index casting, at least for = floats (the fact we handle [=939999999999999999999999999999999=94] = differently to [9999999999999999999999999999999] is a different kettle = of fish, but perhaps also worth discussing). Principle of least = astonishment applies, I think. I think it was agreed with the 64-bit/phpng compromise that array = indices should be 32-bit, but I wonder also if having them be 64-bit = might not be bad, to allow sparse arrays for example. Note that my bigints RFC and patch don=92t use bigint indices. While = probably possible, I really, really don=92t want to try and implement = that. -- Andrea Faulds http://ajf.me/