- Posts: 2696
- Thank you received: 74
Division by zero and Out of memory
14 years 4 months ago - 14 years 4 months ago #50814
by erickb
Division by zero and Out of memory was created by erickb
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
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: 14 years 4 months ago by erickb.
Please Log in or Create an account to join the conversation.
14 years 4 months ago #50895
by nicolas
Replied by nicolas on topic Re: Division by zero and Out of memory
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 ?
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.
14 years 4 months ago - 14 years 4 months ago #50911
by erickb
Replied by erickb on topic Re: Division by zero and Out of memory
// commentar on the line
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
PHP Warning: Division by zero in ./administrator/components/com_hikashop/classes/currency.php on line 1077
Code:
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
Code:
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
Code:
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: 14 years 4 months ago by erickb.
Please Log in or Create an account to join the conversation.
14 years 4 months ago #50918
by nicolas
Replied by nicolas on topic Re: Division by zero and Out of memory
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.
14 years 4 months ago - 14 years 4 months ago #50924
by erickb
Replied by erickb on topic Re: Division by zero and Out of memory
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
l'euro est actif et currency_rate = 1
le dollars est inactif et currency_rate = 1
Last edit: 14 years 4 months ago by erickb.
Please Log in or Create an account to join the conversation.
14 years 4 months ago #50925
by nicolas
Replied by nicolas on topic Re: Division by zero and Out of memory
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.
14 years 4 months ago #50928
by erickb
Replied by erickb on topic Re: Division by zero and Out of memory
Please Log in or Create an account to join the conversation.
14 years 4 months ago #50931
by nicolas
Replied by nicolas on topic Re: Division by zero and Out of memory
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.
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.
14 years 4 months ago #50937
by erickb
Replied by erickb on topic Re: Division by zero and Out of memory
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.
14 years 4 months ago #51067
by nicolas
Replied by nicolas on topic Re: Division by zero and Out of memory
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.
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.
14 years 4 months ago #51172
by erickb
Replied by erickb on topic Re: Division by zero and Out of memory
oui merci
Please Log in or Create an account to join the conversation.
Time to create page: 0.225 seconds