Skip to content

Conversation

@tbradsha
Copy link
Contributor

@tbradsha tbradsha commented Nov 26, 2025

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() and wp_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:

  • Have you written new tests for your changes, if applicable?
  • Have you checked the E2E test CI results, and verified that your changes do not break them?
  • Have you tested your changes on WordPress.com, if applicable (if so, you'll see a generated comment below with a script to run)?

Jetpack product discussion

Does this pull request change what data or activity we track or use?

Testing instructions:

  • Go to '..'

@tbradsha tbradsha requested review from a team and mikestottuk November 26, 2025 17:28
@tbradsha tbradsha self-assigned this Nov 26, 2025
@tbradsha tbradsha added [Status] Needs Review This PR is ready for review. [Type] Janitorial labels Nov 26, 2025
@github-actions github-actions bot added [CRM] Automations Module [CRM] MailPoet Module [CRM] WooSync Module [Plugin] CRM Issues about the Jetpack CRM plugin Admin Page React-powered dashboard under the Jetpack menu labels Nov 26, 2025
@github-actions
Copy link
Contributor

Thank you for your PR!

When contributing to Jetpack, we have a few suggestions that can help us test and review your patch:

  • ✅ Include a description of your PR changes.
  • ✅ Add a "[Status]" label (In Progress, Needs Review, ...).
  • ✅ Add a "[Type]" label (Bug, Enhancement, Janitorial, Task).
  • ✅ Add testing instructions.
  • ✅ Specify whether this PR includes any changes to data or privacy.
  • ✅ Add changelog entries to affected projects

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:

  1. Ensure all required checks appearing at the bottom of this PR are passing.
  2. Make sure to test your changes on all platforms that it applies to. You're responsible for the quality of the code you ship.
  3. You can use GitHub's Reviewers functionality to request a review.
  4. When it's reviewed and merged, you will be pinged in Slack to deploy the changes to WordPress.com simple once the build is done.

If you have questions about anything, reach out in #jetpack-developers for guidance!

@jp-launch-control
Copy link

jp-launch-control bot commented Nov 26, 2025

Code Coverage Summary

Coverage changed in 6 files. Only the first 5 are listed here.

File Coverage Δ% Δ Uncovered
projects/plugins/crm/includes/ZeroBSCRM.Mail.php 0/627 (0.00%) 0.00% 24 💔
projects/plugins/crm/includes/ZeroBSCRM.Edit.Segment.php 0/164 (0.00%) 0.00% 2 ❤️‍🩹
projects/plugins/crm/includes/ZeroBSCRM.ScreenOptions.php 0/81 (0.00%) 0.00% 2 ❤️‍🩹
projects/plugins/crm/admin/dashboard/main.page.php 0/224 (0.00%) 0.00% 1 ❤️‍🩹
projects/plugins/crm/includes/ZeroBSCRM.List.Tasks.php 0/70 (0.00%) 0.00% 1 ❤️‍🩹

Full summary · PHP report

If appropriate, add one of these labels to override the failing coverage check: Covered by non-unit tests Use to ignore the Code coverage requirement check when E2Es or other non-unit tests cover the code Coverage tests to be added later Use to ignore the Code coverage requirement check when tests will be added in a follow-up PR I don't care about code coverage for this PR Use this label to ignore the check for insufficient code coveage.

Copy link
Contributor

@anomiex anomiex left a 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>' );
Copy link
Contributor

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.

Copy link
Contributor Author

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.

tbradsha and others added 2 commits November 26, 2025 13:39
Co-authored-by: Brad Jorsch <anomiex@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Admin Page React-powered dashboard under the Jetpack menu [CRM] Automations Module [CRM] MailPoet Module [CRM] WooSync Module [Plugin] CRM Issues about the Jetpack CRM plugin [Status] Needs Review This PR is ready for review. [Type] Janitorial

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants