|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #69459 Allow retrieving variable references from parent scope(s)
Submitted: 2015-04-15 09:01 UTC Modified: 2020-12-23 15:52 UTC
From: michaelduff2 at yahoo dot com Assigned:
Status: Suspended Package: *General Issues
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: michaelduff2 at yahoo dot com
New email:
PHP Version: OS:


 [2015-04-15 09:01 UTC] michaelduff2 at yahoo dot com
The 'include' construct, by design, inherits the scope where it is executed which is great for templates, however:

When wrapping 'include' in a function to provide augmented include() or require() functionality, there is, AFAIK, no way to retrieve references to all variables from the caller's scope so that they may be imported into the local scope and accessed by the included script.

To provide this functionality, I propose adding a 'vars' element to the array returned by debug_backtrace() and a DEBUG_BACKTRACE_PROVIDE_VARS to optionally enable this functionality.

Note that the resulting 'vars' arrays would be filled with references so that extract() can provide bidirectional access to those variables.

Unless this can't be reasonably accomplished, I am willing to implement the necessary changes myself; please inform me how to submit the code accordingly.

Thank you.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-12-23 15:52 UTC]
-Status: Open +Status: Suspended
 [2020-12-23 15:52 UTC]
This feature request likely requires an RFC[1], so please start
that process.  For the time being, I'm suspending this ticket.

[1] <>
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Mon Jan 25 11:01:23 2021 UTC