Skip to content

Instantly share code, notes, and snippets.

@balloz
Created October 14, 2016 15:18
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save balloz/98ec092dab64bc2564b0765b34711ff2 to your computer and use it in GitHub Desktop.
Save balloz/98ec092dab64bc2564b0765b34711ff2 to your computer and use it in GitHub Desktop.
Unbreak the API in Magento 1.9.3. Not convinced this is correct, as nested properties in objects and arrays do not get the XML escaping magic applied to them. At least this is no less broken than it was before 1.9.3!
diff --git a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
index bfc6763..2566340 100644
--- a/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
+++ b/app/code/core/Mage/Api/Model/Server/Handler/Abstract.php
@@ -556,12 +556,16 @@ abstract class Mage_Api_Model_Server_Handler_Abstract
* @param array $result
* @return mixed
*/
- public function processingMethodResult(array $result)
+ public function processingMethodResult($result)
{
- foreach ($result as &$row) {
- if (!is_null($row) && !is_bool($row) && !is_numeric($row)) {
- $row = $this->processingRow($row);
+ if (is_array($result)) {
+ foreach ($result as &$row) {
+ if (!is_null($row) && !is_bool($row) && !is_numeric($row)&& !is_object($row) && !is_array($row)) {
+ $row = $this->processingRow($row);
+ }
}
+ } elseif (!is_null($result) && !is_bool($result) && !is_numeric($result) && !is_object($row) && !is_array($row)) {
+ $result = $this->processingRow($result);
}
return $result;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment