Y
Y
yii_lover2018-05-16 21:40:05
PHP
yii_lover, 2018-05-16 21:40:05

How to track or fix the "Allowed memory size" error on a site on 1c-bitrix?

If you walk around the site for a while and put goods in the cart (not sure if this affects, but the error occurs in the sale module), then such an error occurs. Unfortunately, the competence is not enough to find it.
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /var/www/ofcydev/bitrix/modules/sale/lib/discount.php(2554) : eval()'d code on line 1
Fatal error: Allowed memory size of 268435456 bytes exhausted (tried to allocate 32768 bytes) in /var/www/ofcydev/bitrix/modules/main/lib/diag/exceptionhandlerlog.php on line 1

Answer the question

In order to leave comments, you need to log in

2 answer(s)
O
Oleg, 2018-05-16
@402d

You NEED to understand where the code is written crookedly.
It's impossible to guess why.
For example, I saw counting the number of records by reading them all, the person simply did not know
about select count ()

Y
yii_lover, 2018-05-16
@yii_lover

I forgot to point out the problem is not in memory allocation, how much do not allocate everything eats
C eval everything is logical in fact. This is a discount condition check function

protected function checkDiscountConditions()
  {

    $checkOrder = null;

    $key = $this->enableCheckingPrediction? 'PREDICTIONS_APP' : 'UNPACK';

    if (empty($this->currentStep['discount'][$key]))
      return false;
    
    eval('$checkOrder='.$this->currentStep['discount'][$key].';');
    if (!is_callable($checkOrder))
      return false;
    $result = $checkOrder($this->orderData);
    unset($checkOrder);
    return $result;
  }

Here $this->currentStep['discount'][$key] any condition can come

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question