Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:88003 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 48301 invoked from network); 2 Sep 2015 07:17:00 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 2 Sep 2015 07:17:00 -0000 Authentication-Results: pb1.pair.com header.from=dmitry@zend.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=dmitry@zend.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain zend.com designates 209.85.223.178 as permitted sender) X-PHP-List-Original-Sender: dmitry@zend.com X-Host-Fingerprint: 209.85.223.178 mail-io0-f178.google.com Received: from [209.85.223.178] ([209.85.223.178:34917] helo=mail-io0-f178.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 1A/86-23910-A62A6E55 for ; Wed, 02 Sep 2015 03:16:59 -0400 Received: by ioiz6 with SMTP id z6so10228291ioi.2 for ; Wed, 02 Sep 2015 00:16:55 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc:content-type; bh=wT35O3WYPJ//zN5cUyQ19PLM8NsCKuPyZPwBlnmeD9w=; b=UD6QtFXvMCSXz+bRiagxMjGC2DSojdGbJI664nfRVEUhG7vvKvib/XUsq6oMCPhIrk glqpgrgLJxlWl4f8ELg27deYleXv2de1AkydAEX1aETVo9LyQJ8BVqd56Y7gEfG5ufT5 Xb5NqPpED2yf7Ajw8oLKcJ1i9cKj4+Zo/PU8tlIY8YlYTfouMonFARf4i5Ff5e4Tozvo VICsRytBUJ1E1+p0jjDS0sO/tTnxqm+qoVjjtejQADkDQaLiV7mlJUnB2M+Lpi99rTwu hbavQhz0kgF4SMUvLiNg39ttPGndSfiNDzXPlbXfEJxfMc2+1uirvY02nq2T2hcfG7j5 m5ZQ== X-Gm-Message-State: ALoCoQmGYn7VHaimnPjb2oTSNkrQzLIfoYhUzMFA6WzMzhJ+not+oKLvFYQvh0rZ1JKjxbFf5KNlVh+ajddB41xawJ7rz6geM9HwwPuaWbNBI5L+IqsI5csXLA4lQl5gWYmDt3AMo3MlwZaYYp2b4ZH/37bYtks0r/RT068Mm7yuwdcPP3cui2M= MIME-Version: 1.0 X-Received: by 10.107.30.144 with SMTP id e138mr10291949ioe.196.1441178215057; Wed, 02 Sep 2015 00:16:55 -0700 (PDT) Received: by 10.50.25.169 with HTTP; Wed, 2 Sep 2015 00:16:54 -0700 (PDT) In-Reply-To: <55E698CA.4040809@gmail.com> References: <55E698CA.4040809@gmail.com> Date: Wed, 2 Sep 2015 10:16:54 +0300 Message-ID: To: Stanislav Malyshev Cc: PHP Internals Content-Type: multipart/alternative; boundary=001a1141c4089147ae051ebe734e Subject: Re: object_properties_load() does not work for non-string keys - intentional? From: dmitry@zend.com (Dmitry Stogov) --001a1141c4089147ae051ebe734e Content-Type: text/plain; charset=UTF-8 Hi Stas, I don't see the crash. Integer keys are supported in exactly the same way as it was in PHP-5. $ sapi/cli/php -r '$a = [1=>5]; $o = (object)$a; var_dump($o); $s = serialize($o); var_dump($s);var_dump(unserialize($s));' object(stdClass)#1 (1) { [1]=> int(5) } string(27) "O:8:"stdClass":1:{i:1;i:5;}" object(stdClass)#2 (1) { ["1"]=> int(5) } if you talk about manually crafted serialize string with for example "float" keys, I think, we should just report a error. Thanks. Dmitry. On Wed, Sep 2, 2015 at 9:35 AM, Stanislav Malyshev wrote: > Hi! > > 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? > -- > Stas Malyshev > smalyshev@gmail.com > --001a1141c4089147ae051ebe734e--