jbroadway/analog

Maximum execution time exceeded (not really a bug)

trasher opened this issue · 2 comments

That is not really an issue, I made a mistake in my code, causing Analog to excess maximum execution time; using multi handler.

My stuff is wrong, not Analog one; but it was quite difficult to figure out what was happening :-)

I get something like:

Analog::log(
    'My message',
    OLD_CONSTANT
);

The "OLD_CONSTANT" value is the issue, since it no longer exists, PHP use constant name as a text value. Once in Analog/Handler/Multi.php file, we go through the while instruction that never ends because of the string instead of integer.

Maybe it would be useful to check if $info['level'] is an integer before entering the while, and either throw an exception or take a default arbitrary value.

Thanks for catching this! I just added a check in Multi that defaults to Analog::ERROR (the default log level) if the value is not numeric.

Cheers,
Johnny

Thank you for the quick fix :)