debugging - PHP - recognize when the function was called -
i'm thinking how find function called. problem need find php calling mail()
function. 1 way use register_tick_function()
, i'll need open each file , check on each line. project huge, take long parse each file in php. other way? or option how override mail()
function?
to override built-in mail function, take @ override_function part of advanced php debugger pecl extension - can use debug_backtrace find out caller details...
//define code override mail function (note i've used php5.3 nowdoc syntax avoid //the need escape dollar symbols!! $code=<<<'code' $trace=debug_backtrace(); $caller=array_shift($trace); echo 'mail() called '.$caller['function'] if (isset($caller['class'])) echo 'in '.$caller['class']; code; //install override override_function('mail', '$to,$subject,$msg,$hdrs,$params', $code);
Comments
Post a Comment