andreskrey/readability.php

Trying to get property 'nodeName' of non-object

Closed this issue · 4 comments

Occasionally I get the following Error:

Trying to get property 'nodeName' of non-object in:
readability.php/src/Readability.php on line 1079

while ($parentOfTopCandidate->nodeName !== 'body') { ...

Do you have a sample HTML? Which version are you using?

I'm using v2.1.0 - I think the error just came recently.
Unfortunately it happens in a kind of a black box so I can't provide a sample HTML.
I tr/catched the error to be still able to use the package.

If you can add some logging in that try catch to record the offending URL would be great. I'll close this issue for now but feel free to reopen it once you have more information.

I have the same:

`PHP Notice: Trying to get property of non-object in .../vendor/andreskrey/readability.php/src/Readability.php on line 1067`

On 3 hosts, 2 hosts don't have this error, but on 1 host this error always arises, above all with HTML content that contains mainly Javascript.

e.g. https://doodle.com/poll/ck6zktpi7n4pv9qd

I use v2.0.0, PHP7.1.32