around line 420

  if (!empty($info)) {
    if (!empty($field['querypath']) && module_exists('querypath')) {
      //TODO: Perhaps cache this QueryPath object as well?
      $response = qp($info,$field['field'],array('encoding' => 'iso-8859-1','ignore_parser_warnings' => true,'convert_from_encoding' => 'ISO-8859-1'))->text(); //,);
}

This works the same but doesn't rebuild the document.

-      $info = (array)$client->{$request_method}($field['resource']);
+      $info = $client->{$request_method}($field['resource']);

For example casting simple xml as an array only make the parent in the document actually an array. The children are still simplexmlelement objects. Don't cast it and send off into qp.

Great use of qp overall though and very useful module!

Side note the options I passed into qp are nice but necessary in the production module. We discovered this bug(and fix/workaround) because _oauthconnector_object_to_qp would give a fatal error due to qp not knowing what the original document encoding was.

If you would like a more formal patch just let me know, I haven't tested this with json/php.

Comments

jlporter’s picture

- $response = _oauthconnector_object_to_qp(qp('<?xml version="1.0"?>'), $info)->find($field['field'])->text();
+ $response = qp($info,$field['field'],array('encoding' => 'iso-8859-1','ignore_parser_warnings' => true,'convert_from_encoding' => 'ISO-8859-1')

Adding the diff to help you find the original code I am referring to.

voxpelli’s picture

Thanks, will look into it when I get time.