backtrace: check the parameter before use it

git-svn-id: https://svn.fournier38.fr/svn/ProgSVN/trunk@3659 bf3deb0d-5f1a-0410-827f-c0cc1f45334c
This commit is contained in:
2017-05-12 19:44:44 +00:00
parent 0d92eebb64
commit 3f11e7637e

View File

@@ -6,9 +6,12 @@ class backtrace
{ {
/** Display the backtrace in the browser /** Display the backtrace in the browser
* use: \backtrace::show (debug_backtrace ()); * use: \backtrace::show (debug_backtrace ());
* @param array $backtrace The backtrace to display
*/ */
public static function show ($backtrace) public static function show ($backtrace)
{ {
if (! is_array ($backtrace))
throw new \Exception ("Backtrace invalid: not an array", 500);
echo "<pre>Debug BackTrace:\n"; echo "<pre>Debug BackTrace:\n";
foreach ($backtrace as $key=>$back) foreach ($backtrace as $key=>$back)
{ {