Infinite recursion/PHP Fatal error: Allowed memory size of 134217728 bytes exhausted


  • Default avatar
    daniel32    
     9 years ago
    0

    Joomla: 2.5.18
    Virtuemart: 2.6.10
    AWOCoupon: 2.3.3.1 pro

    I've setup a coupon to offer free shipping and when applying the coupon I get the memory exhausted error. Doing traces I noticed the code is getting into infinite recursion.

    I tracked down the problem to /administrator/components/com_awocoupon/helpers/estore/virtuemart/couponhandler.php and added some of my own code to fix it (My bits have the ZPL comment)

    <?php
        
    protected function get_storeshipping() {
            if (
    version_compare($this->vmversion'2.9.8''>=')) {
                
    $billtaxrate $this->getbilltaxrate();
            }
            else {
                
    $billtaxrate 0;

                
    $cart_code $this->vmcart->couponCode;
                if(!empty(
    $this->vmcoupon_code)) {
                    
    $this->vmcart->couponCode $this->vmcoupon_code;
                }

                if (
    version_compare($this->vmversion'2.0.16''>=')) 
                {
                    
    $this->vmcart->couponCode null//ZPL
                    
    $this->vmcart->getCartPrices(); // triggers taxbill tax
                    
    $this->vmcart->couponCode $cart_code//ZPL
                
    }
                if(!empty(
    $this->vmcoupon_code)) {
                    
    $this->vmcart->couponCode $cart_code;
                }

            }
            
    $obj = (object) array(
                
    'shipping_id'=>@$this->vmcart->virtuemart_shipmentmethod_id,
                
    'total_notax'=>(float)$this->vmcartPrices['shipmentValue'],
                
    'total'=>(float)$this->vmcartPrices['salesPriceShipment'],
            );

            if(!empty(
    $billtaxrate)) {
                
    $obj->total $obj->total * (1+$billtaxrate);
            }

            return 
    $obj;
        }
    ?>


    I don't fully understand what you are trying to accomplish here so I hope the changes are appropriate.

    Daniel
  • Your avatar
    seyi    
     9 years ago
    0

    Hello,

    Your modifications seem fine. Might be getting into an infinite loop when calling getCartPrices. I will run more tests and if it is fine will add it to the core.