Re: Very minor debugging suggestion for lib.resources.php
Matthew Leingang <leingang-c2Vpf+SSmYbWs/[email protected]> Thu, 10 Jul 2003 13:18:37 -0400 (EDT)
| Newsgroups | gmane.comp.cms.phpslash.devel |
|---|---|
| Message-ID | <[email protected]> |
Hi,
Still unpacking but checking e-mail...
On Thu, 10 Jul 2003, Joe Stewart wrote:
> On Thu, Jul 10, 2003 at 10:57:39AM -0400, Mike Gifford wrote:
> > Howdy,
> >
[snip!]
> > You can't pass arrays to the debug function very well.. I
suppose you
> > could serialize them so
> > debug('List of classes',serialize(get_declared_classes()));
> >
> > In anycase just a thought..
> >
>
> Hey Mike,
>
> debug() should have no trouble outputting arrays. This works fine for me:
>
> debug("declared_classes", get_declared_classes());
I agree. debug() got rewritten for 0.7 to recurse through arrays and
objects.
> What is the value of debug.max_recursion_level in config.ini?
>
> debug.max_recursion_level = 10
This was a guard against circular references. Consider:
$a = new Parent;
$b = new Child;
$a->children[] =& $b;
$b->parent =& $a;
debug("a",$a);
This would go on indefinitely without either (a) a check for circularity
or (b) a maximum level to recurse to. I didn't really know how to do (a)
so I built in (b). I believe if you set
$_PSL['debug.max_recursion_level'] to something negative then you can get
arbitrary recursion (with no circularity checks).
But anyway, the array returned from get_defined_classes should only be
one-dimensional, so 10 is fine for the purpose!
--Matt
----------------------------------------------------------------
Matthew Leingang 617/495-2171
Harvard University leingang-c2Vpf+SSmYbWs/[email protected]
Department of Mathematics "This signature needs no quote."
-------------------------------------------------------
This SF.Net email sponsored by: Parasoft
Error proof Web apps, automate testing & more.
Download & eval WebKing and get a free book.
www.parasoft.com/bulletproofapps1