tijsverkoyen / CssToInlineStyles

CssToInlineStyles is a class that enables you to convert HTML-pages/files into HTML-pages/files with inline styles. This is very usefull when you're sending emails.
BSD 3-Clause "New" or "Revised" License
5.8k stars 187 forks source link

Typed property DOMDocument::$documentElement must not be accessed before initialization #241

Open arifurrahmansw opened 1 year ago

arifurrahmansw commented 1 year ago

image

stof commented 1 year ago

Please provide a reproducer (and ideally one that is built with only the library, not a Laravel app where the usage of the library is hidden in tens of abstraction levels).

stof commented 1 year ago

And can you tell which exact version of PHP you are using ? This might be a bug in ext-dom.

arifurrahmansw commented 1 year ago

Thanks for the quick response. PHP 8.1

stof commented 1 year ago

that's not the exact version.

arifurrahmansw commented 1 year ago

PHP 8.1.0 and Laravel Framework 8.83.27

arifurrahmansw commented 1 year ago

when I upgrade laravel 6 to laravel 8 showing this error.

stof commented 1 year ago

Please upgrade to the latest 8.1.x release to see whether it fixes the issue. PHP has fixed many issues between 8.1.0 and 8.1.14

fakeheal commented 1 year ago

I am having the same problem, my setup includes:

PHP has fixed many issues between 8.1.0 and 8.1.14

What changes of php are releated to this package? Only changes related to DomDocument were last referred to in Version 8.1.11.

DOM: Fixed bug #66783 (UAF when appending DOMDocument to element).

stof commented 1 year ago

Please try to build a standalone reproducer for this issue. Otherwise, there is nothing I can do to debug the issue.

fakeheal commented 1 year ago

Please try to build a standalone reproducer for this issue. Otherwise, there is nothing I can do to debug the issue.

Yeah, sorry, I thought you might be able to suggest a possible problem off the top of your head, since you mentioned issues related to the package based on php's versions. I believe it'd be really hard to create a standalone reproducer of the issue, because as you said in Laravel "usage of the library is hidden in tens of abstraction levels".

Thank you for your time!

stof commented 1 year ago

Well, some of the PHP 8.1.x releases fixed issues related to typed properties in internal classes. But I'm not sure whether this is before or after 8.1.11.

fakeheal commented 1 year ago

I updated my servers php version to 8.2.4 and the issue is no longer there. I also noticed that there's a new 8.1.x version, but I didn't bother checking out before upgrading straight to 8.2. Leaving that here, hope it helps someone.