Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54508 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 6958 invoked from network); 11 Aug 2011 18:54:40 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2011 18:54:40 -0000 Authentication-Results: pb1.pair.com smtp.mail=chrisstocktonaz@gmail.com; spf=pass; sender-id=pass Authentication-Results: pb1.pair.com header.from=chrisstocktonaz@gmail.com; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.213.170 as permitted sender) X-PHP-List-Original-Sender: chrisstocktonaz@gmail.com X-Host-Fingerprint: 209.85.213.170 mail-yx0-f170.google.com Received: from [209.85.213.170] ([209.85.213.170:39248] helo=mail-yx0-f170.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 99/D2-27496-F65244E4 for ; Thu, 11 Aug 2011 14:54:39 -0400 Received: by yxk30 with SMTP id 30so1741750yxk.29 for ; Thu, 11 Aug 2011 11:54:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; bh=rCCiCG6e94Pq2agaReWth/sO2A5Kw1HQL5KIur52YiQ=; b=pKe4HvQnaWIcYqAXLbr2A2jU1Yk82pCcGFyJcHvOIMwnC1iPQabW3qyw1OiL/i7tP7 1Jr47vSxhY90eQp+SoRZq94W4fOO2F2WLAUM5OSaB7UUprAOECw/OBzxzUvUQhW8cZ+f 2f71uf5MOLCabkFHKbLwysEwF0Kz8D4xOjR8E= MIME-Version: 1.0 Received: by 10.42.149.131 with SMTP id w3mr10463713icv.340.1313088876107; Thu, 11 Aug 2011 11:54:36 -0700 (PDT) Received: by 10.42.178.197 with HTTP; Thu, 11 Aug 2011 11:54:36 -0700 (PDT) Date: Thu, 11 Aug 2011 11:54:36 -0700 Message-ID: To: PHP Developers Mailing List Content-Type: text/plain; charset=ISO-8859-1 Subject: The behavior of get_object_vars and array casting when extending ArrayObject From: chrisstocktonaz@gmail.com (Chris Stockton) I was curious if this behavior was expected, it caught me by surprise. A base object I use extends ArrayObject, that class is extended heavily throughout my code and I recently wanted to use get_object_vars, but noticed it returning an empty array. I do not expect get_object_vars to return the properties I set via a ArrayObject, but I would expect explicitly defined properties in sub-classes and even in the ArrayObject extending class to be returned. Is this thinking correct? If everyone agrees this is a bug I can report it and write a patch assuming its not a deep complicated problem. --Code class TestOne { public $TestOne_1 = 1; } class TestTwo extends ArrayObject { public $TestTwo_1 = 1; } class TestThree extends TestTwo { public $TestThree_1 = 1; } $t1 = new TestOne; var_dump((array) $t1, get_object_vars($t1)); $t2 = new TestTwo; var_dump((array) $t2, get_object_vars($t2)); $t3 = new TestThree; var_dump((array) $t3, get_object_vars($t3)); --Produces array(1) { ["TestOne_1"]=> int(1) } array(1) { ["TestOne_1"]=> int(1) } array(0) { } array(0) { } array(0) { } array(0) { } Thanks, -Chris