Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:24840 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 9797 invoked by uid 1010); 21 Jul 2006 13:04:45 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 9781 invoked from network); 21 Jul 2006 13:04:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 21 Jul 2006 13:04:45 -0000 X-PHP-List-Original-Sender: php_lists@realplain.com X-Host-Fingerprint: 69.179.208.43 msa3-mx.centurytel.net Linux 2.4/2.6 Received: from ([69.179.208.43:41181] helo=msa3-mx.centurytel.net) by pb1.pair.com (ecelerity 2.1.1.3 r(11751M)) with ESMTP id D2/3D-29121-BE0D0C44 for ; Fri, 21 Jul 2006 09:04:44 -0400 Received: from pc1 (d14-111.rt-bras.wnvl.centurytel.net [69.179.141.111]) by msa3-mx.centurytel.net (8.13.6/8.13.6) with SMTP id k6LD4dLK006486; Fri, 21 Jul 2006 08:04:39 -0500 Message-ID: <017701c6acc6$3a526be0$0201a8c0@pc1> To: , References: <014e01c6acbe$680b1bc0$0201a8c0@pc1> <10845a340607210543lfe173abq2221a1c833c5d9e1@mail.gmail.com> Date: Fri, 21 Jul 2006 08:04:40 -0500 MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Priority: 3 X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook Express 6.00.2800.1807 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1807 Subject: Re: [PHP-DEV] [PATCH] array_combine is not binary-key safe From: php_lists@realplain.com ("Matt W") Hi Richard, I think I've seen those instances that you're referring to. By fixed length string I assume you mean hard-coded "string_key". Yeah, I would think those should use add_assoc_*_ex() since the length is known (sizeof("string_key") etc.) to save unnecessary strlen() calls. Unless compilers optimize the strlen("string_key") + 1 to a constant from the add_assoc_*() macro. But I wouldn't think that's the case...? :-/ Matt ----- Original Message ----- From: "Richard Quadling" Sent: Friday, July 21, 2006 > Hi, > > There are 46 uses of add_assoc_zval() in the CVS. Many are with fixed > length strings for the key. Should the others all be using > add_assoc_zval_ex() ? > > On 21/07/06, Matt W wrote: > > Hi, > > > > I don't know if array_combine() was intentionally made binary-key unsafe, > > but it seems wrong and inconsistent since binary keys work everywhere else I > > can think of -- including array_flip() and the new array_fill_keys(). And > > updating it is a bit of an optimization by eliminating strlen() calls. :-) > > > > I also changed the error message to be more grammatically-correct and fixed > > some typos in the description. > > > > http://www.realplain.com/php/array_combine_binkey.diff > > http://www.realplain.com/php/array_combine_binkey_5_2.diff > > > > > > Thanks, > > Matt