Division by zero and Out of memory

  • Posts: 2607
  • Thank you received: 65
11 years 11 months ago #50814

I am getting these errors

PHP Warning: Division by zero in ./administrator/components/com_hikashop/classes/currency.php on line 1077

PHP Fatal error: Out of memory (allocated 1572864) (tried to allocate 82 bytes) in ./libraries/joomla/registry/registry.php on line 421
PHP Fatal error: Out of memory (allocated 1310720) (tried to allocate 11243 bytes) ./libraries/joomla/cache/controller.php on line 224

Last edit: 11 years 11 months ago by erickb.

Please Log in or Create an account to join the conversation.

  • Posts: 81604
  • Thank you received: 13082
  • MODERATOR
11 years 11 months ago #50895

Please remember that you're using a pre release version. That line is different in the latest version, in your pre version and in our dev environment.
So I don't know what you have on that line. Could you copy/paste the code there ?

Please Log in or Create an account to join the conversation.

  • Posts: 2607
  • Thank you received: 65
11 years 11 months ago #50911

// commentar on the line

PHP Warning: Division by zero in ./administrator/components/com_hikashop/classes/currency.php on line 1077

if(bccomp($coupon->discount_flat_amount,0,5)){[b]
			[/b]$coupon->discount_flat_amount_orig = round($coupon->discount_flat_amount,(int)$currenciesData[$coupon->discount_currency_id_orig]->currency_locale['int_frac_digits']);
			if($srcCurrency->currency_id!=$mainCurrency->currency_id){
				if(bccomp($srcCurrency->currency_percent_fee,0,2)){
					$coupon->discount_flat_amount+=$coupon->discount_flat_amount*floatval($srcCurrency->currency_percent_fee)/100.0;
				}
				$coupon->discount_flat_amount=(floatval($coupon->discount_flat_amount)/floatval($srcCurrency->currency_rate));  // line 1077
			}
			if($dstCurrency->currency_id!=$mainCurrency->currency_id){
				$coupon->discount_flat_amount=floatval($coupon->discount_flat_amount)*floatval($dstCurrency->currency_rate);
				if(bccomp($dstCurrency->currency_percent_fee,0,2)){
					$coupon->discount_flat_amount+=$coupon->discount_flat_amount*floatval($dstCurrency->currency_percent_fee)/100.0;
				}
			}
			$coupon->discount_flat_amount=round($coupon->discount_flat_amount,(int)$currenciesData[$coupon->discount_currency_id]->currency_locale['int_frac_digits']);
		}else{
			$coupon->discount_flat_amount=0;
}


PHP Fatal error: Out of memory (allocated 1572864) (tried to allocate 82 bytes) in ./libraries/joomla/registry/registry.php on line 421
protected function bindData(&$parent, $data)
	{
		// Ensure the input data is an array.
		if (is_object($data))
		{
			$data = get_object_vars($data);
		}
		else
		{
			$data = (array) $data;
		}

		foreach ($data as $k => $v)
		{
			if ((is_array($v) && JArrayHelper::isAssociative($v)) || is_object($v))
			{
				$parent->$k = new stdClass;
				$this->bindData($parent->$k, $v);
			}
			else
			{
				$parent->$k = $v; // line 421
			}
		}
	}


PHP Fatal error: Out of memory (allocated 1310720) (tried to allocate 11243 bytes) ./libraries/joomla/cache/controller.php on line 224

public function store($data, $id, $group = null)
	{
		$locktest = new stdClass;
		$locktest->locked = null;
		$locktest->locklooped = null;

		$locktest = $this->cache->lock($id, $group);

		if ($locktest->locked == false && $locktest->locklooped == true)
		{
			$locktest = $this->cache->lock($id, $group);
		}

		$sucess = $this->cache->store(serialize($data), $id, $group); // line 224

		if ($locktest->locked == true)
		{
			$this->cache->unlock($id, $group);
		}

		return $sucess;
	}

Last edit: 11 years 11 months ago by erickb.

Please Log in or Create an account to join the conversation.

  • Posts: 81604
  • Thank you received: 13082
  • MODERATOR
11 years 11 months ago #50918

You have a currency with a rate of 0 on your website. That should not be possible. Please check your currency rates.

Please Log in or Create an account to join the conversation.

  • Posts: 2607
  • Thank you received: 65
11 years 11 months ago #50924

j'ai laisse 2 currency et supprime tout le reste
l'euro est actif et currency_rate = 1
le dollars est inactif et currency_rate = 1

Last edit: 11 years 11 months ago by erickb.

Please Log in or Create an account to join the conversation.

  • Posts: 81604
  • Thank you received: 13082
  • MODERATOR
11 years 11 months ago #50925

Vous avez une monnaie avec un taux à 0 sur votre site. Ca n'est pas possible. Veuillez vérifier vos monnaies.

Please Log in or Create an account to join the conversation.

  • Posts: 2607
  • Thank you received: 65
11 years 11 months ago #50928
Attachments:

Please Log in or Create an account to join the conversation.

  • Posts: 81604
  • Thank you received: 13082
  • MODERATOR
11 years 11 months ago #50931

Alors vous avez un coupon/une réduction configuré avec une des monnaies que vous avez supprimé.

Sachez que cela ne sert à rien de supprimer les monnaies. Elles seront réinstallées automatiquement lors de la prochaine mise à jour.

Please Log in or Create an account to join the conversation.

  • Posts: 2607
  • Thank you received: 65
11 years 11 months ago #50937

non tous les coupons ont étés fait après et la seule monnaie active est l'euro

Please Log in or Create an account to join the conversation.

  • Posts: 81604
  • Thank you received: 13082
  • MODERATOR
11 years 11 months ago #51067

Rajoutez le code:
if($srcCurrency->currency_rate>0)

devant:
$coupon->discount_flat_amount=(floatval($coupon->discount_flat_amount)/floatval($srcCurrency->currency_rate));

et cela corrigera le problème.

Please Log in or Create an account to join the conversation.

  • Posts: 2607
  • Thank you received: 65
11 years 11 months ago #51172

oui merci

Please Log in or Create an account to join the conversation.

Time to create page: 0.080 seconds
Powered by Kunena Forum