Mantis Bugtracker
  

Viewing Issue Simple Details Jump to Notes ] View Advanced ] Issue History ] Print ]
ID Category Severity Reproducibility Date Submitted Last Update
0003611 [Quercus] minor always 07-27-09 10:43 07-27-09 10:47
Reporter tlandmann View Status public  
Assigned To
Priority normal Resolution open  
Status new   Product Version 4.0.0
Summary 0003611: Call Stack getting broken (apparently)
Description The script below prints an impossible result in Quercus:
Suddenly the bottom of the call stack (invocation of some_function() from the end of the script) is gone.

However it seems that the bug is only limited to debug_backtrace(), so there're no negative effect on programs that don't rely on this PHP function.

I didn't prove that though.


--------------------

<?php

function dump_trace()
{
    foreach (debug_backtrace() as $cur_stack_element)
    {
        echo "# {$cur_stack_element['function']}() from {$cur_stack_element['file']}:{$cur_stack_element['line']}\n";
    }
    echo "\n";
}

function some_function($depth=0, $max_depth=5)
{
    if ($depth<$max_depth)
    {
        dump_trace();
        
        if ($depth==2)
        {
            $function_name='some_function';
            $function_name($depth+1, $max_depth); // this syntax, although valid PHP, causes the problem
        }
        else
        {
            some_function($depth+1, $max_depth); // works
            // call_user_func_array($function_name, array($depth+1, $max_depth)); // may also want to try this one -> it also works
        }
    }
}

some_function();

dump_trace();

?>

----------------
Additional Information
Attached Files

- Relationships

- Notes
(0004101)
tlandmann
07-27-09 10:47

sample output of the script running in Quercus:

------------------------

# dump_trace() from test2.php:16
# some_function() from test2.php:31

# dump_trace() from test2.php:16
# some_function() from test2.php:25
# some_function() from test2.php:31

# dump_trace() from test2.php:16
# some_function() from test2.php:25
# some_function() from test2.php:25
# some_function() from test2.php:31

# dump_trace() from test2.php:16
# some_function() from test2.php:25
# some_function() from test2.php:25

# dump_trace() from test2.php:16
# some_function() from test2.php:25
# some_function() from test2.php:25
# some_function() from test2.php:25

# dump_trace() from test2.php:33

------------------------

output from standard PHP 5.2.6:

------------------------

# dump_trace() from test2.php:16
# some_function() from test2.php:31

# dump_trace() from test2.php:16
# some_function() from test2.php:25
# some_function() from test2.php:31

# dump_trace() from test2.php:16
# some_function() from test2.php:25
# some_function() from test2.php:25
# some_function() from test2.php:31

# dump_trace() from test2.php:16
# some_function() from test2.php:21
# some_function() from test2.php:25
# some_function() from test2.php:25
# some_function() from test2.php:31

# dump_trace() from test2.php:16
# some_function() from test2.php:25
# some_function() from test2.php:21
# some_function() from test2.php:25
# some_function() from test2.php:25
# some_function() from test2.php:31

# dump_trace() from test2.php:33

------------------------
 

- Issue History
Date Modified Username Field Change
07-27-09 10:43 tlandmann New Issue
07-27-09 10:47 tlandmann Note Added: 0004101


Mantis 1.0.0rc3[^]
Copyright © 2000 - 2005 Mantis Group
28 total queries executed.
25 unique queries executed.
Powered by Mantis Bugtracker