Jump to content

Webservice fatal error - Memory size exhausted


Recommended Posts

Hi, when I run this command:

 

$webService -> get(array('url' => PS_SHOP_PATH . '/api/products?schema=synopsis'));

 

or open this url (when _PS_MODE_DEV_ = true)

 

http://domain.tld/api/products?schema=synopsis

 

It gives me:

Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 71 bytes) in /classes/db/DbPDO.php on line 148

 

It's only small XML schema and I have 128M memory limit..

What's wrong?

 

Thanks

Edited by inPrestashop (see edit history)
Link to comment
Share on other sites

  • 1 month later...

I find a solution, this is my override :

 

class WebserviceRequest extends WebserviceRequestCore
{
public function getFilteredObjectList()
{
 $objects = array();
 $filters = $this->manageFilters();

 if (!isset($this->urlFragments['schema'])) {
   $this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_join'];
   $this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_filter'];
   $this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_sort'];
   $this->resourceConfiguration['retrieveData']['params'][] = $filters['sql_limit'];
   //list entities
   $tmp = new $this->resourceConfiguration['retrieveData']['className']();
   $sqlObjects = call_user_func_array(array($tmp, $this->resourceConfiguration['retrieveData']['retrieveMethod']), $this->resourceConfiguration['retrieveData']['params']);
   if ($sqlObjects)
   {
 foreach ($sqlObjects as $sqlObject)
  $objects[] = new $this->resourceConfiguration['retrieveData']['className']((int)$sqlObject[$this->resourceConfiguration['fields']['id']['sqlId']]);
 return $objects;
   }
 }
}
}

Link to comment
Share on other sites

×
×
  • Create New...