php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #21236 debug_backtrace() doesn't give function args within the same file
Submitted: 2002-12-28 03:00 UTC Modified: 2003-01-21 03:47 UTC
From: julian at beta4 dot com Assigned:
Status: Not a bug Package: Scripting Engine problem
PHP Version: 4.3.0 OS: Linux
Private report: No CVE-ID: None
 [2002-12-28 03:00 UTC] julian at beta4 dot com
when you get the stack trace from debug_backtrace(), alal the frames for calls to functions within a file have no function arguments listed.

If you move a function into another file and call it, then its arguments will be listed.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2003-01-20 18:31 UTC] julian at beta4 dot com
A friend tried this and doesn't seem to see the problem.  The main difference is that he is testing with Apache 1.3 whereas I was testing with Apache 2... perhaps that is the key somehow?  I will try to test it myself when I have time but I thought it might click for someone so I'm noting it now.
 [2003-01-20 21:02 UTC] sniper@php.net
Please add a short example script which shows the problem
clearly.

 [2003-01-20 21:36 UTC] julian at beta4 dot com
Ok... you need 2 files.

--------------file1.php-----------------------
<?php
require 'file2.php';

function f2($param) {
	f3($param);
}

function f1($param) {
	f2($param);
}

f1('foo');
?>
----------end file1.php---------------

----------file2.php---------------
<?php

function f3($param) {
	echo '<table border="1">';

	$backtrace = debug_backtrace();

	foreach ( $backtrace as $frame ) {
		echo "<tr><td>$frame[file]</td><td>$frame[line]</td><td>$frame[function]</td><td>";
		print_r($frame['args']);
		echo "</td></tr>\n";
	}

	echo '</table>';
}
?>
-------------end file2.php---------------

On my server (apache2, php4.3) I get:
/home/julian/public_html/file1.php 5 f3 Array ( [0] => foo )  
/home/julian/public_html/file1.php 9 f2  
/home/julian/public_html/file1.php 12 f1  

But on my friend's server (apache1.3, php4.3) - though there are surely plenty of other differences as well - I get:
/web/sites/Julian/docs/file1.php 5 f3 Array ( [0] => foo )  
/web/sites/Julian/docs/file1.php 9 f2 Array ( [0] => foo )  
/web/sites/Julian/docs/file1.php 12 f1 Array ( [0] => foo )
 [2003-01-21 00:27 UTC] sniper@php.net
This worked for me with both PHP/CLI and under Apache2 just fine..

How did you configure PHP and Apache2?
What MPM is Apache2 running as?
Which Apache2 version?

 [2003-01-21 01:58 UTC] julian at beta4 dot com
Aha!

Trying it with the CLI inspired me.  I tried it myself and still had problems, but that eliminated apache2 as the problem.  Then I realized I had Zend Optimizer enabled and that proved to be the problem -disabling Optimizer makes it work properly.  I guess that makes a certain amount of sense.

Do you have any idea if that would be considered a bug in Optimizer or if it's just an unavoidable problem?
 [2003-01-21 03:47 UTC] sniper@php.net
Definately optimizer bug. You need to report that to Zend..

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Mon Jul 21 19:00:03 2025 UTC