#21236 [Opn->Fbk]: debug_backtrace() doesn't give function args within the same file

From: Date: Tue, 21 Jan 2003 06:27:22 +0000
Subject: #21236 [Opn->Fbk]: debug_backtrace() doesn't give function args within the same file
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-30787@lists.php.net to get a copy of this message
ID: 21236 Updated by: sniper@php.net Reported By: julian@beta4.com -Status: Open +Status: Feedback Bug Type: Scripting Engine problem Operating System: Linux PHP Version: 4.3.0 New Comment: 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? Previous Comments: ------------------------------------------------------------------------ [2003-01-20 21:36:19] julian@beta4.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-20 21:02:27] sniper@php.net Please add a short example script which shows the problem clearly. ------------------------------------------------------------------------ [2003-01-20 18:31:47] julian@beta4.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. ------------------------------------------------------------------------ [2002-12-28 03:00:17] julian@beta4.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. ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=21236&edit=1

« previous php.bugs (#30787) next »