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

-- 
[EMAIL PROTECTED] | http://www.trachtenberg.com
author of o'reilly's "upgrading to php 5" and "php cookbook"
avoid the holiday rush, buy your copies today!

-- 
PHP Internals - PHP Runtime Development Mailing List
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to