-
Notifications
You must be signed in to change notification settings - Fork 330
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’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Update DOMLex.php #292
base: master
Are you sure you want to change the base?
Update DOMLex.php #292
Conversation
Fixed two issues where property references that don't exist cause errors on PHP 8 (on docker setup by "tiredofit").
Also fixed another instance of "undefined property" error.
By any chance do you know where in the libxml changelog DOM was modified in this way? That would help me assess this change. |
Could this be a PHP 8 issue? Normally undefined properties are notice level. But for some reason in my setup for freescount (running under Docker/PHP 8), the undefined properties are triggering a ErrorExceptions. Perhaps laravel framework sets up error reporting this way. I am a bit confused as well. Would sharing the HTML string for messages that trigger this help you recreate this error? |
@ezyang I am going to close this PR, it turns out this might be what I'm looking for: |
reopening because we ought to be notice clean |
I tried to run the tests locally, but failed (Wanted to see if I could create a failing test case for you). Failing that though, I can recreate this under my envrionment. So I'm attaching the input that causes the error. Also the error log is as below:
Fair warning (don't click on any links in the attached file). From that rabbit hole of following the function calls, I was able to determine that most likely the purifier makes its entry over here: |
@ezyang This seems to be very specific to my environment. When I checked out this repository and ran the purify function with the basic config & the input attached above, it did not display any notices or error exceptions. I will try to reproduce in a clean php 8 docker container to see if I get the same issue. If that is true, I'll have a reproducible test case for you. |
@@ -194,7 +194,7 @@ protected function createStartNode($node, &$tokens, $collect, $config) | |||
} elseif ($node->nodeType === XML_CDATA_SECTION_NODE) { | |||
// undo libxml's special treatment of <script> and <style> tags | |||
$last = end($tokens); | |||
$data = $node->data; | |||
$data = $node->data ?? ""; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Use of null coalesce operator should be reflected in min PHP version required in composer.json
(e.g.: "php": ">=7.0"
), otherwise the library will be broken on older installations.
Fixed two issues where property references that don't exist cause errors on PHP 8 (on docker setup by "tiredofit").