Re: PEAR_ErrorStack and staticCallback(...)
| From: | Greg Beaver | Date: | Wed, 12 May 2004 20:52:20 +0000 |
| Subject: | Re: PEAR_ErrorStack and staticCallback(...) | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-29163@lists.php.net to get a copy of this message | ||
Hi Sean,
The code for staticPushCallback() assumes you have already instantiated the error stacks that you plan to use, which is of course a silly assumption, but I didn't realize it until you posted this code. To fix temporarily, add the line I've inserted below, and please do open a bug.
Greg
Sean Coates wrote:
Hello dev list. Had a smallish conversation on IRC about this, and it was suggested that I post to the list. Consider the following code: <?php require_once('PEAR.php'); require_once('PEAR/ErrorStack.php'); function static_callback() { echo "static_callback(...) called.\n"; print_r(func_get_args()); } PEAR_ErrorStack::singleton('teststack');
PEAR_ErrorStack::staticPushCallback('static_callback'); PEAR_ErrorStack::staticPush('teststack', 100, 'error', array('test' => 'testing'), 'test error -- testing callback'); // static_callback() is never called ?> It SEEMS that staticPush never calls the callback -- I took a look through the code (ErrorStack.php) and I'm not sure why this happens. If this is a user (my) error, I offer my sincere apologies for troubling the dev list, but I believe this to be a PEAR problem -- please correct me if I'm being stupid (-: I would like some confirmation before I file this as a bug, but will be happy to do so if this is determined to be a bug. Thanks, S