Req #69459 [NEW]: Allow retrieving variable references from parent scope(s)
| From: | michaelduff2 at yahoo dot com | Date: | Wed, 15 Apr 2015 09:01:29 +0000 |
| Subject: | Req #69459 [NEW]: Allow retrieving variable references from parent scope(s) | ||
| Groups: | php.bugs | ||
| Request: | Send a blank email to php-bugs+get-192083@lists.php.net to get a copy of this message | ||
From: michaelduff2 at yahoo dot com
Operating system:
PHP version: Irrelevant
Package: *General Issues
Bug Type: Feature/Change Request
Bug description:Allow retrieving variable references from parent scope(s)
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 bug report at https://bugs.php.net/bug.php?id=69459&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=69459&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=69459&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=69459&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=69459&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=69459&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=69459&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=69459&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=69459&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=69459&r=support
Expected behavior: https://bugs.php.net/fix.php?id=69459&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=69459&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=69459&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=69459&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=69459&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=69459&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=69459&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=69459&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=69459&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=69459&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=69459&r=mysqlcfg