Bug #18161 Updated: backtrace and zend engine 2 (alpha 2)
| From: | optikSmoke at subdimension dot com | Date: | Tue, 16 Jul 2002 19:35:19 +0000 |
| Subject: | Bug #18161 Updated: backtrace and zend engine 2 (alpha 2) | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-14335@lists.php.net to get a copy of this message | ||
ID: 18161
Updated by: optikSmoke@subdimension.com
Reported By: ol@globalis-ms.com
Status: Open
Bug Type: Zend Engine 2 problem
Operating System: linux - i386
PHP Version: 4CVS-2002-07-04
New Comment:
Ummm, I believe the problem you are having is that you
are calling debug_backtrace() from the top level of the
script. I have been using debug_backtrace() quite
effectively to develop a printStackTrace() method for
exceptions in my scripts, and in my testing I found that
it will nnot output anything unless the call is made from
within a function/method. eg:
<?
function foo() {
debug_backtrace();
print_r(debug_backtrace());
}
foo();
?>
Try that. I could be wrong, but I don't think
debug_backtrace() was meant to be used from the top level
of scripts.
Previous Comments:
------------------------------------------------------------------------
[2002-07-04 07:12:26] ol@globalis-ms.com
Hi,
I've tried to test the backtrace function in zend engine 2 alpha 2. And
i'm not able to get any usable output.
Is it a known bug (no KNOWN_BUG file, in archive), or it's just not the
right way to use it ?
Example 1 (from the Change log doc)
Output -> <empty>
<?php
$backtrace = debug_backtrace();
foreach ($backtrace as $step) {
$class = isset($step['class']) ? $step['class'] . '::' :
'';
printf(
"%s [%s:%s]\n",
$step['function'],
$step['file'],
$step['line']
);
}
?>
Example 2 (from my own)
Output -> <empty Array>
<?php
function foo(){
echo "function --> foo\n";
}
$backtrace = debug_backtrace();
foo();
print_r($backtrace);
?>
Thanks,
My conf:
./configure --without-apache --without-pear
on a linuxbox - slackware 8.1 / i386
--
Ol
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18161&edit=1