Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:76262 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 89463 invoked from network); 30 Jul 2014 06:50:18 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 30 Jul 2014 06:50:18 -0000 Authentication-Results: pb1.pair.com header.from=tjerk.meesters@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=tjerk.meesters@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.192.41 as permitted sender) X-PHP-List-Original-Sender: tjerk.meesters@gmail.com X-Host-Fingerprint: 209.85.192.41 mail-qg0-f41.google.com Received: from [209.85.192.41] ([209.85.192.41:48305] helo=mail-qg0-f41.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id A8/B7-29261-9A598D35 for ; Wed, 30 Jul 2014 02:50:18 -0400 Received: by mail-qg0-f41.google.com with SMTP id q107so959542qgd.14 for ; Tue, 29 Jul 2014 23:50:30 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=subject:mime-version:content-type:from:in-reply-to:date:cc :content-transfer-encoding:message-id:references:to; bh=ZQW5mVAETMwafg8Jvum+gf54jSQ4d0oRAQwfxgJQFH4=; b=h+ly898KdpueBsNFQLXR0Wnp2kp5CVzlGmASfv2oavWnrf6GJScOpKS0u5dQH50iCC tbySziBiiR31zvBvjZ3oB+ViHIMFkY66FSIy9g4tdG/AwAZAdVUFyeeYd14L+egN+3Q+ tMnZAAyRXcXCd89BYS9k8kSiDclrZVXMz9D2PO5djK474gG3sVG/Yxz1m6gSNbrUplrd q9mLovFD4T8rxyrX5SQUt4t89gONqq6q7gy+8ChCV9PubbwJgXlb0/ZmcdrnQB7Pl8+H VPF/5j5W8ly0McqPPOTpW7OWyePKLxaOXGfBIE/mPQ4TX996OtNzEtn8uzxDLvRHEPno Wewg== X-Received: by 10.140.93.44 with SMTP id c41mr3031175qge.106.1406703030764; Tue, 29 Jul 2014 23:50:30 -0700 (PDT) Received: from [172.18.12.18] ([198.211.103.38]) by mx.google.com with ESMTPSA id z9sm1618405qge.4.2014.07.29.23.50.28 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Tue, 29 Jul 2014 23:50:30 -0700 (PDT) Mime-Version: 1.0 (Mac OS X Mail 7.3 \(1878.6\)) Content-Type: text/plain; charset=windows-1252 X-Priority: 3 In-Reply-To: <633025718.351649.1406699307462.open-xchange@app2.ox.registrar-servers.com> Date: Wed, 30 Jul 2014 14:50:22 +0800 Cc: yohgaki@ohgaki.net, PHP Internals Content-Transfer-Encoding: quoted-printable Message-ID: <204B9BC6-2DA9-452A-854B-7EA260A19543@gmail.com> References: <633025718.351649.1406699307462.open-xchange@app2.ox.registrar-servers.com> To: Andrea Faulds X-Mailer: Apple Mail (2.1878.6) Subject: Re: [PHP-DEV] signed long hash index for PHP7? From: tjerk.meesters@gmail.com (Tjerk Meesters) On 30 Jul, 2014, at 1:48 pm, Andrea Faulds wrote: >=20 >=20 >> On July 30, 2014 at 6:01 AM Tjerk Meesters = wrote: >>=20 >>=20 >> Instead of doing that, why not simply disallow negative array indices = to be >> used as integers? >>=20 >> In other words, negative indices are treated as if you had used = strings so >> that it doesn't upset the the last numeric index kept in the array >> structure. >>=20 >> =46rom what I can tell, it should be a pretty simply patch. >>=20 >> Thoughts? >=20 > That would make sense, but doesn't solve all edge cases as your = maximum array > index is still more than 2 times the largest positive integer on = 32-bit. Is that by design, a bug or something else entirely? Could you explain = this edge case with some code? >=20 > Perhaps we should completely change behaviour and forbid negative = indices and > store indexes that are too large as strings? That would be the sanest = way to go > IMO, solves all the edge cases, and makes = ["999999999999999999999999999"] and > [999999999999999999999999999] consistent, resolving that long-existing > discrepancy. Forbidding negative indices is a bit harsh and imho quite unnecessary; = turning =93out of range=94 indices into strings should work just fine = afaict. Is there a reason why it shouldn=92t? A compromise could be to allow string keys that would otherwise have = converted into a negative integer, but disallow negative int/float = explicitly. > -- > Andrea Faulds