Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:98563 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 18381 invoked from network); 16 Mar 2017 05:46:46 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 16 Mar 2017 05:46:46 -0000 Authentication-Results: pb1.pair.com header.from=sebastian@php.net; sender-id=unknown Authentication-Results: pb1.pair.com smtp.mail=sebastian@php.net; spf=unknown; sender-id=unknown Received-SPF: unknown (pb1.pair.com: domain php.net does not designate 188.94.27.5 as permitted sender) X-PHP-List-Original-Sender: sebastian@php.net X-Host-Fingerprint: 188.94.27.5 scarlet.netpirates.net Received: from [188.94.27.5] ([188.94.27.5:38530] helo=scarlet.netpirates.net) by pb1.pair.com (ecelerity 2.1.1.9-wez r(12769M)) with ESMTP id D3/C8-38004-0C62AC85 for ; Thu, 16 Mar 2017 00:46:42 -0500 Received: (qmail 14310 invoked by uid 89); 16 Mar 2017 05:47:50 -0000 Received: by simscan 1.4.0 ppid: 14302, pid: 14305, t: 0.0455s scanners: attach: 1.4.0 clamav: 0.99.1/m:/d:20700 Received: from unknown (HELO ?192.168.178.52?) (php@sebastian-bergmann.de@87.156.219.2) by scarlet.netpirates.net with ESMTPA; 16 Mar 2017 05:47:50 -0000 To: internals@lists.php.net References: Message-ID: <6e7bccc2-dc22-f530-024f-aabe0062e424@php.net> Date: Thu, 16 Mar 2017 06:46:40 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Subject: Re: [PHP-DEV] Add __toArray() method to objects that would be called on cast to array From: sebastian@php.net (Sebastian Bergmann) Am 15.03.2017 um 23:33 schrieb Marco Pivetta: > Also the only way to get all properties from an instance of an inheritance tree. I use the Reflection API in https://github.com/sebastianbergmann/object-reflector/blob/master/src/ObjectReflector.php#L24 for retrieving inherited non-public attributes from an object by traversing the inheritance chain using while ($reflector = $reflector->getParentClass()). I wish the ReflectionObject would allow access to all attributes of an object no matter whether an attribute is declared in the class of the object or in a parent class.