Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

馃悰 [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 this issue Dec 16, 2023 · 10 comments
Labels
bug Something isn't working

Comments

@maofree
Copy link
Sponsor

maofree commented Dec 16, 2023

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 maofree added the bug Something isn't working label Dec 16, 2023
@maofree
Copy link
Sponsor Author

maofree commented Dec 16, 2023

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 maofree changed the title 馃悰 [BUG] - Big problems with Litespeed - Blank page when webp is enabled in is_themecore with a website on netsons 馃悰 [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 Dec 17, 2023
@maofree
Copy link
Sponsor Author

maofree commented Dec 17, 2023

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
Copy link
Sponsor Author

maofree commented Dec 17, 2023

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
Copy link
Owner

Oksydan commented Jan 2, 2024

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
Copy link
Sponsor Author

maofree commented Jan 2, 2024

Hi
is it necessary to set so?

libxml_use_internal_errors(true);
$this->doc->loadHTML('' . $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
Copy link
Owner

Oksydan commented Jan 6, 2024

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
Copy link

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
Copy link
Sponsor Author

maofree commented Feb 21, 2024

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

thanks

@Oksydan
Copy link
Owner

Oksydan commented Feb 26, 2024

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
Copy link
Sponsor Author

maofree commented Apr 11, 2024

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('' . $this->content, LIBXML_HTML_NOIMPLIED | LIBXML_HTML_NODEFDTD);
libxml_clear_errors();

    return $this;
}`

9

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

bye

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants