We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Direction
extract($this->tempData); can overwrites existed variables
extract($this->tempData);
Describe the bug
CodeIgniter4/system/View/View.php
Line 295 in 0489678
Line 212 in 0489678
It's can overwrites existed variables (arguments and etc.).
CodeIgniter 4 version 4.0.4, master
Fix
Need add wrapper-functions to capture output and keep scope resolution, for example:
function (string $viewCode, array $viewData): string { extract($viewData, EXTR_SKIP); ob_start(); eval('?>' . $viewCode); return (string) ob_get_clean(); }
or
function (string $viewCode, array $viewData): string { $viewFileHandler = tmpfile(); fwrite($viewFileHandler, $viewCode); unset($viewCode); extract($viewData, EXTR_SKIP); ob_start(); include(stream_get_meta_data($viewFileHandler)['uri']); fclose($viewFileHandler); return (string) ob_get_clean(); }
The text was updated successfully, but these errors were encountered:
Successfully merging a pull request may close this issue.
Direction
extract($this->tempData);
can overwrites existed variablesDescribe the bug
CodeIgniter4/system/View/View.php
Line 295 in 0489678
CodeIgniter4/system/View/View.php
Line 212 in 0489678
It's can overwrites existed variables (arguments and etc.).
CodeIgniter 4 version
4.0.4, master
Fix
Need add wrapper-functions to capture output and keep scope resolution, for example:
or
The text was updated successfully, but these errors were encountered: