openlabs/magento — pull request #2 by iiijjjii (2011-10-21 22:14:07+00:00)
Title: Magento logs error when Customer.list() called without filters.

This isn't horribly critical but Magento logs an error message whenever the Customer.list() api call is used without filters. My solution was to pass an empty filters dict.

Here is specifics of the error:

errorCode: 8
errorMessage: Undefined variable: filters
errorFile: /srv/http/magento/app/code/core/Mage/Customer/Model/Customer/Api.php
errorLine: 101

Here is an excerpt of the code.

96 public function items($filters)
97 {
98 $collection = Mage::getModel('customer/customer')->getCollection()
99 ->addAttributeToSelect('*');
100
101 if (is_array($filters)) {
102 try {
103 foreach ($filters as $field => $value) {
104 if (isset($this->_mapAttributes[$field])) {
105 $field = $this->_mapAttributes[$field];
106 }
107
108 $collection->addFieldToFilter($field, $value);
109 }
110 } catch (Mage_Core_Exception $e) {
111 $this->_fault('filters_invalid', $e->getMessage());
112 }
113 }