note 102609 added to function.debug-print-backtrace

[email protected] Thu, 24 Feb 2011 04:26:18 -0800
Newsgroups php.notes
Message-ID <[email protected]>
Most methods of getting the backtrace and printing are susceptible to a certain runtime flaw.

If the user is able to produce 100+ errors this will throw an error which in turn will throw 100+ errors on each nest of get_args() creating an infinite loop and eventually downing your server.

If you are looking for a simple backtrace that (so far) will not fall to this error then use this:

    foreach(debug_backtrace() as $k=>$v){
    	if($v['function'] == "include" || $v['function'] == "include_once" || $v['function'] == "require_once" || $v['function'] == "require"){
			$backtracel .= "#".$k." ".$v['function']."(".$v['args'][0].") called at [".$v['file'].":".$v['line']."]<br />";
    	}else{
			$backtracel .= "#".$k." ".$v['function']."() called at [".$v['file'].":".$v['line']."]<br />";
		}
    }
----
Server IP: 69.147.83.197
Probable Submitter: 81.187.108.206
----
Manual Page -- http://www.php.net/manual/en/function.debug-print-backtrace.php
Edit        -- https://master.php.net/note/edit/102609
Del: integrated  -- https://master.php.net/note/delete/102609/integrated
Del: useless     -- https://master.php.net/note/delete/102609/useless
Del: bad code    -- https://master.php.net/note/delete/102609/bad+code
Del: spam        -- https://master.php.net/note/delete/102609/spam
Del: non-english -- https://master.php.net/note/delete/102609/non-english
Del: in docs     -- https://master.php.net/note/delete/102609/in+docs
Del: other reasons-- https://master.php.net/note/delete/102609
Reject      -- https://master.php.net/note/reject/102609
Search      -- https://master.php.net/manage/user-notes.php