-
Notifications
You must be signed in to change notification settings - Fork 1.9k
New issue
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
Bug: esc(..., 'raw') fails on recursive data structures #8624
Labels
bug
Verified issues on the current code behavior or pull requests that will fix them
Comments
Cleric-K
added
the
bug
Verified issues on the current code behavior or pull requests that will fix them
label
Mar 14, 2024
You have a valid point. Can you send a PR? |
Cleric-K
added a commit
to Cleric-K/CodeIgniter4
that referenced
this issue
Mar 18, 2024
Cleric-K
added a commit
to Cleric-K/CodeIgniter4
that referenced
this issue
Mar 18, 2024
Cleric-K
added a commit
to Cleric-K/CodeIgniter4
that referenced
this issue
Mar 18, 2024
Cleric-K
added a commit
to Cleric-K/CodeIgniter4
that referenced
this issue
Mar 18, 2024
Cleric-K
added a commit
to Cleric-K/CodeIgniter4
that referenced
this issue
Mar 19, 2024
Cleric-K
added a commit
to Cleric-K/CodeIgniter4
that referenced
this issue
Mar 20, 2024
Cleric-K
added a commit
to Cleric-K/CodeIgniter4
that referenced
this issue
Mar 20, 2024
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
PHP Version
8.2
CodeIgniter4 Version
4.4.6
CodeIgniter4 Installation Method
Composer (as dependency to an existing project)
Which operating systems have you tested for this bug?
Linux
Which server did you use?
apache
Database
No response
What happened?
In the process of upgrading from CI3 -> 4, I encountered a problem with a
view()
that uses a fairly complex$data
structure including &references between elements. Even though theview()
helper callssetData()
with$context = 'raw'
, this still ends up in infinite recursion becauseesc()
iterates through the fields of the array and callsesc(..., 'raw')
on them. This whole operation is completely unnecessary because in the end it does not escape anything. However, because of the self-references, this walking of the array ends up in infinite recursion.The
esc()
function should return$data
immediately in the case of 'raw'. There's no need to walk the whole array tree just to build it anew.Steps to Reproduce
A non-realistic example, just to illustrate the point:
Expected Output
The exact same $data array, without iterating its values.
Anything else?
No response
The text was updated successfully, but these errors were encountered: