Req #69459 [Opn->Sus]: Allow retrieving variable references from parent scope(s)

From: Date: Wed, 23 Dec 2020 15:52:00 +0000
Subject: Req #69459 [Opn->Sus]: Allow retrieving variable references from parent scope(s)
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-231237@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=69459&edit=1 ID: 69459 Updated by: cmb@php.net Reported by: michaelduff2 at yahoo dot com Summary: Allow retrieving variable references from parent scope(s) -Status: Open +Status: Suspended Type: Feature/Change Request Package: *General Issues PHP Version: Irrelevant Block user comment: N Private report: N New Comment: 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> Previous Comments: ------------------------------------------------------------------------ [2015-04-15 09:01:28] 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. ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=69459&edit=1

« previous php.bugs (#231237) next »