Newsgroups: php.internals Path: news.php.net Xref: news.php.net php.internals:18223 Return-Path: Mailing-List: contact internals-help@lists.php.net; run by ezmlm Delivered-To: mailing list internals@lists.php.net Received: (qmail 92100 invoked by uid 1010); 19 Aug 2005 08:18:02 -0000 Delivered-To: ezmlm-scan-internals@lists.php.net Delivered-To: ezmlm-internals@lists.php.net Received: (qmail 92085 invoked from network); 19 Aug 2005 08:18:02 -0000 Received: from unknown (HELO lists.php.net) (127.0.0.1) by localhost with SMTP; 19 Aug 2005 08:18:02 -0000 X-Host-Fingerprint: 65.124.18.202 miranda.org Linux 2.4/2.6 Received: from ([65.124.18.202:41565] helo=miranda.org) by pb1.pair.com (ecelerity 2.0 beta r(6323M)) with SMTP id 8B/D0-33075-AB595034 for ; Fri, 19 Aug 2005 04:18:02 -0400 Received: (qmail 10347 invoked by uid 546); 19 Aug 2005 04:17:59 -0400 Received: from localhost (sendmail-bs@127.0.0.1) by localhost with SMTP; 19 Aug 2005 04:17:59 -0400 Date: Fri, 19 Aug 2005 04:17:59 -0400 (EDT) X-X-Sender: adam@miranda.org To: Rasmus Lerdorf cc: internals@lists.php.net In-Reply-To: <430593FF.6020907@lerdorf.com> Message-ID: References: <43054765.3000208@lerdorf.com> <430593FF.6020907@lerdorf.com> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Subject: Re: [PHP-DEV] Simplexml and xml namespaces From: adam@trachtenberg.com (Adam Maccabee Trachtenberg) On Fri, 19 Aug 2005, Rasmus Lerdorf wrote: > Yeah, I agree actually. My real beef is that simplexml and var_dump() > don't place nicely with each other. var_dump() ends up lumping the > namespaced elements in with the non-namespaced elements of the same > name, but when you iterate through things manually they are not lumped > together and the only way to get at the namespaced elements is by > checking for them directly with the appropriate children() call. > > I am fine with having to manually dereference the namespace and keeping > things completely separate. I'd just like it to be easier for people to > use var_dump() on a simplexml object and not have it confuse the heck > out of them by showing them arrays with 2 elements in them which when > they iterate only get 1 or if they call count() on it only get 1. I totally agree with this. In fact, I'd say this is a specific instance of a more general problem -- overloaded objects just don't play nicely with var_dump() and friends. Overloading is cool, but it makes it much harder to debug objects because there's no standard way to introspect them to see how things "really" are under the covers, and when you do use var_dump(), you may get lied to in all sorts of unpredictable ways and not even know it, as there's no way to know a priori that an object is overloaded. -adam -- adam@trachtenberg.com | http://www.trachtenberg.com author of o'reilly's "upgrading to php 5" and "php cookbook" avoid the holiday rush, buy your copies today!