Oksydan / falcon

Prestashop starter theme that provides great development experience.
GNU General Public License v3.0
257 stars 61 forks source link

πŸ› [BUG] - Blank page when webp is enabled in is_themecore with a website on netsons - DOMDocument::loadHTML(): Memory allocation failed in Entity, line: 8 in is_themecore/src/Core/Webp/WebpPictureGenerator.php on line 19 #359

Open maofree opened 10 months ago

maofree commented 10 months ago

Description

Hi after many tests I think there is a problem with shared plans (with dedicated server and vps is ok)

PHP Warning: DOMDocument::loadHTML(): Memory allocation failed in Entity, line: 8 in /home/kvgzrseu/public_html/NUOVO/modules/is_themecore/src/Core/Webp/WebpPictureGenerator.php on line 19

I get this error from the error_log file in the webroot, because any other errors are shown in the front-office the problem gives a blank page in the front-office

it happens after to set Webp to on, in the module is_themecore the website is on netsons, ssd100 solution it has litespeed but it is not due from it, because the same site on the dedicated server works well, however the dedicated server is on another hosting

perhaps this plan does not have enough resources in the image conversion phase.

now I'm having all the missing webp images regenerated by prestashop in the copy on the dedicated server, since with litespeed it is not possible to do this from the is_themecore module, due to compatibility problems in the htaccess file

1

bye

Node.js version

v16

php version

8.1

OS and it's version

linux

Browsers

Chrome

Required module/theme

is_themecore

Reproduction steps

1. use a shared solution on netsons

Logs

No response

maofree commented 10 months ago

I copied the site to the other server, I redid the operations to remove the old theme and add the new one, and now the blank page doesn't appear. Maybe it was due to another error. I'll continue and then I'll let you know, before I was very depressed

maofree commented 10 months ago

Hi the problem continues to be present even if all the webp images have been regenerated, so I don't know what it depends on, if it is a compatibility problem with the netsons server configuration

maofree commented 10 months ago

Hi I moved the site to another server that has a shared plan but of a different hosting than netsons which uses cpanel and litespeed. there is the same problem, in the front only a blank page appears with the same errors in the error_log file maybe it could be a problem when there is cpanel and litespeed which is used for sites in shared plans. instead for VPS and dedicated servers Plesk and Litespeed are used and in this case there are no problems

Oksydan commented 10 months ago

Hi @maofree,

I am not sure yet how I am going to rewrite webp/avif functionality for is_themecore 5 but for now you can try to suppress errors here https://github.com/Oksydan/is_themecore/blob/main/src/Core/Webp/WebpPictureGenerator.php#L19 via libxml_use_internal_errors(true);

maofree commented 10 months ago

Hi is it necessary to set so?

libxml_use_internal_errors(true); $this->doc->loadHTML('<?xml encoding="utf-8" ?>' . $this->content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); libxml_clear_errors(); return $this;

https://www.php.net/manual/en/function.libxml-use-internal-errors.php

Oksydan commented 10 months ago

Hi @maofree,

you can give it a try. I am not able to reproduce the problem. It might be related to server configuration πŸ€” or it's limitation. I am not familiar with lightspeed.

tomasz3k commented 8 months ago

Hi there, I've got same error on my shared hosting. After doing some super extra magic debug I've ended with solution.

In modules/is_themecore/src/Hook/HtmlOutput.php change $params['html'] = $content; to $params['html'] = &$content; So do not copy entire html to new var just pass a reference to it. Don't know why but it works. I thought that its memory limit problem but I have 512MB limit same as dev server so it is not this.

maofree commented 8 months ago

Hi @tomasz3k I confirm that with this solution I can active webp from is_themecore on netsons with litespeed

thanks

Oksydan commented 8 months ago

Hi @tomasz3k, I will test try to test it and check memory usage πŸ€”. If everything will be ok I am going to release one more patch version before version 5. There are few issues that could be closed before main version release. I would like to get ride of DOMDocument in version 5 of the is_themecore module but I have to find something similar with nice API. I don't want to reinvent the wheel and spend too much time on it.

maofree commented 7 months ago

Hi some weeks ago I used this solution In modules/is_themecore/src/Hook/HtmlOutput.php change $params['html'] = $content; to $params['html'] = &$content; but today, after enabling debugging, I reviewed the problems related to WebpPictureGenerator I've seen them disappear using this solution

` public function loadContent() { libxml_use_internal_errors(true); $this->doc->loadHTML('<?xml encoding="utf-8" ?>' . $this->content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD); libxml_clear_errors();

    return $this;
}`

9

however I continue to use $params['html'] = &$content;

bye