|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #65875 Stack trace and reflection failure on include/require.
Submitted: 2013-10-10 14:57 UTC Modified: -
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:0 (0.0%)
From: RQuadling at GMail dot com Assigned:
Status: Open Package: Reflection related
PHP Version: Irrelevant OS: n/a
Private report: No CVE-ID: None
Have you experienced this issue?
Rate the importance of this bug to you:

 [2013-10-10 14:57 UTC] RQuadling at GMail dot com

debug_backtrace() contains 'function' or 'class' and 'function' entries to help you determine where the code came from.

No problem with that.


If the backtrace includes 'include' or 'require' (and their 'once' variants'), these are reported as 'function' in the backtrace.

Again, no problem so far. Ish.

If you use ReflectionFunction or ReflectionMethod to gather and report additional information about the trace, you get an error when dealing with the include/require entries.

Uncaught exception 'ReflectionException' with message 'Function require_once() does not exist'.

What is also interesting is that the output is slightly different for include/require.

For a normal method/function, the order of the elements in the backtrace are :

    'file' => 'SomeClass.php',
    'line' => 121,
    'function' => 'SomeMethod',
    'class' => 'SomeClass',
    'type' => '->',
    'args' => 
    array (

But for include/require, ...

    'file' => 'SomeFile.php',
    'line' => 4,
    'args' => 
    array (
      0 => '/incluldes/SomeClass.php',
    'function' => 'require_once',

So, some specialisation already exists in the backtrace for these non-functions.

This is confirmed at

If the debug_backtrace could include a marker indicating that the element in the trace is not reflected, OR, allow reflection of include/require (and if there was a way for eval also), then this could improve things a bit.

Though, I think, just a documentation upgrade in ReflectionXXX and debug_xxx to indicate that code constructs are not reflected could cover this.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2015-03-10 23:33 UTC] kenorb at gmail dot com
Still happening in PHP 5.4.19
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jul 18 03:01:28 2024 UTC