cancel
Showing results for 
Search instead for 
Did you mean: 

Weird error when saving customer data

Weird error when saving customer data

When I run this code in a customer_save_after observer

 

$customer2 = Mage::getModel('customer/customer')->load(73);
      
try{        
  $customer2->setDomain("");
  $customer2->save();       
}
catch(exception $e){
  Mage::log($e);
}

Domain is a custom attribute.

I get the following error:

Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 130968 bytes)

It says the error comes from Zend (Date.php)

Does anyone know where this comes from? The above works fine outside of this observer.

I have set the Max_memory to 1gb

1 REPLY

Re: Weird error when saving customer data

You have an observer look for a customer_save_after event.   You are loading a customer object and then saving it.  My guess is your observer is then triggering the customer_save_after event  running again, loading a customer object and saving it.   You end up in an infinite loop of this observer running.   

Certified Plus Magento Developer | Top 50 Magento Contributor for 2017 | CEO/Founder at Jamersan | I make Magento videos at Ecommerce-aholic