Details
-
Bug
-
Status: Closed (View Workflow)
-
Major
-
Resolution: Won't Fix
-
3.2.0
-
None
-
None
Description
HI,
When we use a trigger_error('text', E_USER_WARNING) in the event core.user_setup_after, PHP enter in a loop.
How to reproduce this bug?
Create a basic extension that use the event : core.user_setup_after
In the event_listener, add a trigger_error()
trigger_error('"core.user_setup_after" loop', E_USER_WARNING); |
Why there is a loop?
When the $user->setup() is called, the dispatcher (at line 336) load listener that use the core.user_setup_after event.
When the trigger_error() is called in our event listener, the function msg_handler() is called and try to check if $user->is_setup() is true.
But, as the $user->setup() is not fully loaded, the property is_setup_flag is still defined to false and the msg_handler() load (again) the $user->setup() (line 3396), and at this moment we enter in the loop.
If I try to stop the loop, by adding some checks before the trigger_error(), PHP returns a WARNING.
I've partially fixed this issue (on my board) by adding a setter for the property is_setup_flag.
This setter is added on the event listener before the trigger_error().
I'm not sure that is the best way to fix it, but it works.