M
M
Mikhail Smirnov2017-02-18 10:01:19
PHP
Mikhail Smirnov, 2017-02-18 10:01:19

Bitrix, PHPExcel and HttpExceptionHandlerOutput not found error?

Good afternoon!
The site has a script that creates a price list of ~ 10,000 products
yesterday I noticed that the script sometimes crashes with an error:

Fatal error: Class 'Bitrix\Main\Diag\HttpExceptionHandlerOutput' not found in /home/bitrix/www/bitrix/modules/main/lib/httpapplication.php on line 54

It turned out that this is somehow connected with the CFile::ResizeImageGet method, with the help of which the cards are resized to be inserted into the price
. Code examples:
while($ob = $res->GetNextElement()) {
        $fields = $ob->GetFields();

 	$resizeImage = CFile::ResizeImageGet(
    $fields["~DETAIL_PICTURE"],
          array("width" => 150, "height" => 150),
    BX_RESIZE_IMAGE_PROPORTIONAL,
     true
        );
        
        if (!$resizeImage) {
            $fields['DETAIL_PICTURE'] = '/local/templates/eshop_bootstrap_black/components/bitrix/catalog.element/quick-view/images/no_photo.png';
        } else {
            $fields['DETAIL_PICTURE'] = $resizeImage['src'];
        }

  $fields['IMAGE_PATH'] = $_SERVER["DOCUMENT_ROOT"] . $fields['DETAIL_PICTURE'];

        $arElements[] = $fields;
}

At this stage, the $arElements array is created, there are no errors,
then PHPExcel is connected
$objWriter = PHPExcel_IOFactory::createWriter($excel, 'Excel2007');
    $objWriter->save($filePath);

and when saving the excel file, an error will fly out
Fatal error: Class 'Bitrix\Main\Diag\HttpExceptionHandlerOutput' not found in /home/bitrix/www/bitrix/modules/main/lib/httpapplication.php on line 54

I tried to send a smaller number of products to PHPExcel, trying to find out on which product the script breaks, but the error can fall out when processing 4000, or 6000, in short, it’s not clear what it is for.
If you remove image resizing from the code, everything works fine. I also tried instead of all the pictures to poke the picture no_photo.png with it, a price list of 10,000 products is also normally created,
in the general result, this is connected with CFile:: ResizeImageGet, which, according to the code, is connected above Phpexcel and, in theory, should not affect its work in any way

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
Andrey, 2017-02-22
@flx12

could it be the picture? try to log on which picture the script is crashing

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question