SourceForge has been redesigned. Learn more.

#7 Reworked code to ignore errors from certain libraries

ccHost (6)
John Bintz

This patch reworks how cc_error_handler() in cc-debug.php handles ignoring errors triggered by certain libraries (PEAR, PHPTAL, and getID3). Before this patch, for every time that the cc_error_handler() was called, strpos() could be run up to three times. Now, the results of the strpos() checks are cached on a per-filename basis. The first time a PHP file triggers an error, the strpos() checks are cached, and any subsequent errors triggered by that file use the cached results, skipping strpos().

When loading the homepage on a brand new install on my laptop, strpos() was called 3451 times from cc_error_handler() before this patch. After the patch, it was called 199 times. These results were gathered using Xdebug/KCacheGrind.


  • John Bintz

    John Bintz - 2007-06-29

    Patch to cc-debug.php to reduce strpos() usage

  • John Bintz

    John Bintz - 2007-06-29
    • priority: 5 --> 3
  • Jon Phillips

    Jon Phillips - 2007-08-26
    • priority: 3 --> 6

Log in to post a comment.