graby icon indicating copy to clipboard operation
graby copied to clipboard

Error: Call to a member function saveXML() on null

Open kolaente opened this issue 2 years ago • 2 comments

I'm trying to run Graby like this:

$graby = new Graby();
$graby->fetchContent('http://www.bbc.com/news/entertainment-arts-32547474');

it fails with this error:

Error: Call to a member function saveXML() on null
/opt/project/vendor/j0k3r/graby/src/Extractor/ContentExtractor.php:163
/opt/project/vendor/j0k3r/graby/src/Graby.php:318
/opt/project/vendor/j0k3r/graby/src/Graby.php:136
/opt/project/tests/Feature/HttpCrawlTest.php:39

I dug in a little, and it seems like the $dom property of the Readability class never gets initialized. I wonder why that is the case?

I'm using php 8.2 with the changes from #332.

kolaente avatar Jun 26 '23 07:06 kolaente

Maybe look at https://github.com/j0k3r/graby/pull/286, it moves the init function.

jtojnar avatar Jun 26 '23 07:06 jtojnar

That works! Thanks!

kolaente avatar Jun 26 '23 07:06 kolaente