avoid creating expensive stacktrace in dbg_deprecated()

now the method is aborting early again unless the data is actually used
This commit is contained in:
Andreas Gohr 2018-06-01 14:02:54 +02:00
parent adda4e936d
commit 8533108670
1 changed files with 8 additions and 0 deletions

View File

@ -441,8 +441,16 @@ function dbglog($msg,$header=''){
* Log accesses to deprecated fucntions to the debug log
*
* @param string $alternative The function or method that should be used instead
* @triggers INFO_DEPRECATION_LOG
*/
function dbg_deprecated($alternative = '') {
global $conf;
global $EVENT_HANDLER;
if(!$conf['allowdebug'] && !$EVENT_HANDLER->hasHandlerForEvent('INFO_DEPRECATION_LOG')) {
// avoid any work if no one cares
return;
}
$backtrace = debug_backtrace();
array_shift($backtrace);
$self = $backtrace[0];