-
Notifications
You must be signed in to change notification settings - Fork 843
CRM: Ensure proper flags are used with json_encode() #46111
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
base: trunk
Are you sure you want to change the base?
Conversation
|
Thank you for your PR! When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:
This comment will be updated as you work on your PR and make changes. If you think that some of those checks are not needed for your PR, please explain why you think so. Thanks for cooperation 🤖 Follow this PR Review Process:
If you have questions about anything, reach out in #jetpack-developers for guidance! |
Code Coverage SummaryCoverage changed in 6 files. Only the first 5 are listed here.
If appropriate, add one of these labels to override the failing coverage check:
Covered by non-unit tests
|
anomiex
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Gave it a once-over.
#46092 (review) may be useful when reviewing.
| } else { | ||
|
|
||
| $this->debug( 'Company import failed: <code>' . json_encode( $crm_object_data['company'] ) . '</code>' ); | ||
| $this->debug( 'Company import failed: <code>' . wp_json_encode( $crm_object_data['company'], JSON_UNESCAPED_SLASHES | JSON_HEX_TAG | JSON_HEX_AMP ) . '</code>' ); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Similar to the above, the output will probably be nicer if you do esc_html() or the like instead of JSON_HEX_TAG.
Assuming this even really outputs HTML at all? It looks like it might be a CLI job?
Same for the other instances later in this file.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
As I recall, there's an in-plugin debug log, so it would show HTML. That said, I'm gonna leave these alone with the priority of safety over pretty.
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
Closes MONOREP-264
See MONOREP-129 and further discussion in p1763997995289799-slack-C05Q5HSS013.
This is a best-effort application of proper flags for
json_encode()andwp_json_encode()in the CRM plugin.Note that there were a lot of linting alerts that cascaded due to these changes. Sorry to the reviewer.
Proposed changes:
Other information:
Jetpack product discussion
Does this pull request change what data or activity we track or use?
Testing instructions: