Reply to debug_backtrace and FILE/LINE indices

Your name:

Reply:


Posted by Taras_96 on 04/24/07 15:48

Hi all,

I've been using debug_backtrace() for a while to provide stack traces
for a custom logging function. Today was the first time I've got the
following error:

"Notice: Undefined index: file in E:\webroot\lib\errors.php on line
341

Notice: Undefined index: line in E:\webroot\lib\errors.php on line
341"

related to the following code:

$vDebug = debug_backtrace();
$vFiles = array();
for ($i=0;$i<count($vDebug);$i++) {
// skip the first one, since it's always this func
if ($i==0) { continue; }
$aFile = $vDebug[$i];
var_dump($aFile);
$vFiles[] = '('.basename($aFile['file']).':'.
$aFile['line'].')';
} // for
return implode(',',$vFiles);

I checked the PHP documentation for this function, and to my surprise
found that:

"The *possible* returned elements are as follows:", ie: 'file' and
'line' wont always be returned. When are these elements returned, so
that I can make the function do something useful when file/line isn't
returned?

Thanks

Taras

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация