PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Authentication » LiveUser » Bug #509

LiveUser_Error ignores handlers

Details

Submitted2004-01-02 15:55 UTC
Fromjmikola at burgiss dot com
Assignedlsmith
StatusNo Feedback
PackageLiveUser
PHP VersionIrrelevant
OSANY
Roadmaps(Not assigned)

Comments

[2004-01-02 15:55 UTC] jmikola at burgiss dot com

Description:
------------
message originally posted to the mailing list regarding bug:

regarding the LiveUser_Error class, i'd like to know if there's anything i can do short of modifying its code in LiveUser.php which would allow me to use my own error handler (callback) when errors of this type are constructed.

currently, i have a custom handler defined for the PEAR base class, which directs PEAR::DB's errors to get caught; however, noting the parent constructor call in LiveUser_Error with the default mode of PEAR_ERROR_RETURN, i don't see how i could implement a custom handler.

even if i were to change that mode value to the appropriate callback constant, where exactly would i pass the reference to my function? i confess that previously i've never dealt directly with PEAR_Error... only the PEAR::setErrorHandling function. i checked out the actual code for that today, and only concluded that it set some global constants, but i couldn't really trace back the references in PEAR_Error to them.

[2004-01-05 15:36 UTC] jmikola at burgiss dot com

The DB error class seems to cooperate with PEAR::setErrorHandling. I call this function to apply a callback to trigger whenever an error object is constructed. As expected, DB triggers this function as it should, but I was unable to ensure that LiveUser_Error did as well. A glance over the code seemed to explain why:

The LiveUser_Error constructor defaults the mode argument to PEAR_ERROR_RETURN, and proceeds to pass it directly to the PEAR_Error constructor. I'm not entirely familiar with Pear's error class, but this snippet suggests to me that Pear's global mode that I set manually is being ignored in favor of the argument supplied in LiveUser_Error's call.

Additionally, this was discussed with Arnaud Limbourg around 12/22/03 via the mailing list, and he posted the following:

"I started to write that it should wrote, quickly wrote a test script and it doesn't work indeed."

If LiveUser's error class is written no differently than DB_Error, i see no reason why setErrorHandling wouldn't work, unless I must call LiveUser_Error::setErrorHandling... although DB doesn't require I do so.

[2004-05-13 10:37 UTC] smith at backendmedia dot com

No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.