Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:54509 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 8534 invoked from network); 11 Aug 2011 18:58:47 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 11 Aug 2011 18:58:47 -0000 Authentication-Results: pb1.pair.com header.from=ekneuss@gmail.com; sender-id=pass Authentication-Results: pb1.pair.com smtp.mail=ekneuss@gmail.com; spf=pass; sender-id=pass Received-SPF: pass (pb1.pair.com: domain gmail.com designates 209.85.214.42 as permitted sender) X-PHP-List-Original-Sender: ekneuss@gmail.com X-Host-Fingerprint: 209.85.214.42 mail-bw0-f42.google.com Received: from [209.85.214.42] ([209.85.214.42:42195] helo=mail-bw0-f42.google.com) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id 00/33-27496-666244E4 for ; Thu, 11 Aug 2011 14:58:46 -0400 Received: by bkd19 with SMTP id 19so1230781bkd.29 for ; Thu, 11 Aug 2011 11:58:42 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :content-transfer-encoding; bh=JyQmW00JRofD5eXv7z6nIscDAtzLo6EP/URAiYRsjAE=; b=chHDKXYd4fYsibeANWwvMQ9TySBp6KPf1bGMfWGvlcPslBbMZSV4b9IDFXCLGifztw cB3HYuW3QOPZAbSWLBojVODIMG9/KN+4keRRWVVbLeCi7ezy+8BD2Htfjp33IHKiovvp +WxRkvuqNwv9hYM2q0M3HS9lwHq4KRm6yHCbY= MIME-Version: 1.0 Received: by 10.204.36.206 with SMTP id u14mr2636083bkd.382.1313089122664; Thu, 11 Aug 2011 11:58:42 -0700 (PDT) Sender: ekneuss@gmail.com Received: by 10.204.50.199 with HTTP; Thu, 11 Aug 2011 11:58:42 -0700 (PDT) In-Reply-To: References: Date: Thu, 11 Aug 2011 20:58:42 +0200 X-Google-Sender-Auth: qBWFMcpmtSISUpNJQRL8g91gORk Message-ID: To: Chris Stockton Cc: PHP Developers Mailing List Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: quoted-printable Subject: Re: [PHP-DEV] The behavior of get_object_vars and array casting when extending ArrayObject From: colder@php.net (Etienne Kneuss) Hello, On Thu, Aug 11, 2011 at 20:54, Chris Stockton w= rote: > 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 =C2=A0assuming its not a deep complicated > problem. ArrayObject extends the handler responsible for giving you such information. So it might very well be a bug. You should report it! Best, > > --Code > class TestOne { > =C2=A0public $TestOne_1 =3D 1; > } > > class TestTwo extends ArrayObject { > =C2=A0public $TestTwo_1 =3D 1; > } > > class TestThree extends TestTwo { > =C2=A0public $TestThree_1 =3D 1; > } > > $t1 =3D new TestOne; > var_dump((array) $t1, get_object_vars($t1)); > > $t2 =3D new TestTwo; > var_dump((array) $t2, get_object_vars($t2)); > > $t3 =3D new TestThree; > var_dump((array) $t3, get_object_vars($t3)); > > --Produces > array(1) { > =C2=A0["TestOne_1"]=3D> > =C2=A0int(1) > } > array(1) { > =C2=A0["TestOne_1"]=3D> > =C2=A0int(1) > } > > array(0) { > } > array(0) { > } > > array(0) { > } > array(0) { > } > > > Thanks, > > -Chris > > -- > PHP Internals - PHP Runtime Development Mailing List > To unsubscribe, visit: http://www.php.net/unsub.php > > --=20 Etienne Kneuss http://www.colder.ch