Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88064 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 17470 invoked from network); 6 Sep 2015 17:34:45 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 6 Sep 2015 17:34:45 -0000 X-Host-Fingerprint: 2.122.81.212 unknown Received: from [2.122.81.212] ([2.122.81.212:19385] helo=localhost.localdomain) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id EE/45-59944-4397CE55 for ; Sun, 06 Sep 2015 13:34:45 -0400 Message-ID: To: internals@lists.php.net References: <55E698CA.4040809@gmail.com> Date: Sun, 6 Sep 2015 18:34:38 +0100 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.10; rv:38.0) Gecko/20100101 Firefox/38.0 SeaMonkey/2.35 MIME-Version: 1.0 In-Reply-To: <55E698CA.4040809@gmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit X-Posted-By: 2.122.81.212 Subject: Re: object_properties_load() does not work for non-string keys -intentional? From: ajf@ajf.me (Andrea Faulds) Hey Stas, Stanislav Malyshev wrote: > > Working on unserialize edge case patches backporting, I've discovered > that object_properties_load() function crashes if the properties array > contains non-string keys (which can happen on unserialize). Now, I can > fix the crash, but I can fix it in two ways: > 1. Ignore such keys (i.e. such properties will be banned, BC break > against 5.x) > 2. Treat such keys as in 5.x i.e. insert them in the hash. > > So, I wanted to know if dropping non-string keys there was intentional > or not? Sadly I can't tell you if it was intentional. If I were to hazard a guess, though, it sounds like an oversight on the part of the function author. Both cases are rather undesirable. The optimum would be to throw an error of some sort if there's a non-string key, but that might break things. Perhaps take option (2), inserting the keys into the hash (it seems to be the consistent thing to me), but show an E_NOTICE warning you this is happening? I hope that's helpful. -- Andrea Faulds http://ajf.me/