Drupal uses fix_gpc_magic() to compensate for web-server environments that have "magic quotes" enabled, such that $_POST data are always extracted consistently. However, the parse_str() method that is used by ServicesParserURLEncoded->parse() does not apply the same kind of compensation, which leads to inconsistent data parsing when the same resource is deployed in environments that are configured differently. Currently, values that contain single or double quotes will get mangled on some machines before the data arguments reach a resource callback method.

The ServicesParserURLEncoded->parse() method must always extract the data values the same way, irrespective of the get_magic_quotes_gpc() configuration.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

Tiaan’s picture

Status: Active » Needs review
FileSize
847 bytes

The attached patch uses drupal_get_query_array(), instead of parse_str(), which works irrespective of the specific "magic quotes" settings of a website.

Status: Needs review » Needs work

The last submitted patch, servicesparserurlencoded_mangles_data-2123447-1.patch, failed testing.

Tiaan’s picture

Version: 7.x-3.5 » 7.x-3.x-dev
Issue summary: View changes
Status: Needs work » Needs review
FileSize
847 bytes

Attached is the same patch as before, except for being renamed to have the project name as prefix, and targeting the 3.x-dev branch.

marcingy’s picture

Status: Needs review » Reviewed & tested by the community
ygerasimov’s picture

Status: Reviewed & tested by the community » Fixed

Committed. Thanks.

kylebrowning’s picture

Hrmm, this is breaking all of my tests locally.

kylebrowning’s picture

Status: Fixed » Needs work

Ive rolled this back, because its breaking my tests and I cannot seem to get it to pass on my local.

If you turn off magic quotes, the tests break, so this fix is not finished.

ygerasimov’s picture

Status: Needs work » Closed (won't fix)

Sorry for committing. If this breaks tests lets close this issue with won't fix status. It is pretty easy to override this part for custom implementation.