Skip to content

GitLab

  • Projects
  • Groups
  • Snippets
  • Help
    • Loading...
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in
C
Core
  • Project overview
    • Project overview
    • Details
    • Activity
    • Releases
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 920
    • Issues 920
    • List
    • Boards
    • Labels
    • Service Desk
    • Milestones
  • Operations
    • Operations
    • Incidents
  • Analytics
    • Analytics
    • Repository
    • Value Stream
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Members
    • Members
  • Collapse sidebar
  • Activity
  • Graph
  • Create a new issue
  • Commits
  • Issue Boards
  • Development
  • Core
  • Issues
  • #426

Closed (moved)
Open
Opened Oct 09, 2018 by eileen@eileen🎱Owner

REST API calls using json param do not work in Wordpress context --backslashes are added

There is a long discussion on this on this PR but the approach still appears to be unresolved. I have closed the PR to track through gitlab https://github.com/civicrm/civicrm-core/pull/12813


The issue:

When CiviCRM receives an API request through extern/rest.php with a json parameter, and the CMS is WordPress, an error will result.

This is because Civi bootstraps WordPress to authenticate the API user, and WordPress escapes all quotation marks in $_POST variables whether or not PHP's magic_quotes_gpc is enabled. CiviCRM is not expecting an escaped string, and JSON decoding fails due to the extra backslashes. See wp_magic_quotes() which is called by wp-settings.php during bootstrap.

Edited Mar 04, 2019 by noah
To upload designs, you'll need to enable LFS and have admin enable hashed storage. More information
Assignee
Assign to
None
Milestone
None
Assign milestone
Time tracking
None
Due date
None
Reference: dev/core#426