Skip to content
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

CLOUD-2557 Ensure only strings are decoded by Twig filter #22962

Closed

Conversation

marcel-innocraft
Copy link

Description:

When rendering DataTables returned via the ProxySite plugin, it's possible that some columns contain arrays. The template calls the addFilterSafeDecodeRaw() method for each column within the result set and will trigger the following PHP exception if the column contains a non-scalar value:

An exception has been thrown during the rendering of a template ("urldecode(): Argument #1 ($string) must be of type string, array given").

Review

@michalkleiner
Copy link
Contributor

@marcel-innocraft I think it might be more valuable to identify the cases where the column becomes an array to resolve those. Would you have any insights on that?

@marcel-innocraft
Copy link
Author

@marcel-innocraft I think it might be more valuable to identify the cases where the column becomes an array to resolve those. Would you have any insights on that?

I initially wanted to fix the issue at the source as well, but I believe the error is only occurring when URLs are manually crafted to populate additional visitor data such as actionDetails (an array) - so I don't think that data is something we normally render as part of a report. It's also possible for plugins to populate columns with arrays via the API.Live.getLastVisitsDetails event, which present more opportunities for the error to be triggered.

The solution in this PR will blank out any non-scalar values the renderer encounters, which means the values are indistinguishable from actual blank values, so this was a draft while I was considering alternative ways to handle it. The options are fairly limited though.

@sgiehl
Copy link
Member

sgiehl commented Jan 23, 2025

@marcel-innocraft Would it be worth to at least add some logging when non scalar values occur? Otherwise we might hide some real bugs we do not discover anymore 🤔

@marcel-innocraft
Copy link
Author

Given this is a rare error and that when it happens then we are logging it appropriately, I think it's best to close this off and we'll deal with any occurrences if/when they arise.

@sgiehl sgiehl deleted the CLOUD-2557-datatable-viz-urldecode-error branch January 28, 2025 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants