php.net |  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
Have you experienced this issue?
Rate the importance of this bug to you:

 [2015-04-15 09:01 UTC] michaelduff2 at yahoo dot com
Description:
------------
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.


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

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

[1] <https://wiki.php.net/rfc/howto>
 
PHP Copyright © 2001-2021 The PHP Group
All rights reserved.
Last updated: Tue Jan 26 19:01:24 2021 UTC