shweshi / OpenGraph

A Laravel package to fetch Open Graph data of a website.
https://opengraph.shashi.dev
MIT License
157 stars 29 forks source link

Update OpenGraph.php #60

Closed alinmiron closed 4 years ago

alinmiron commented 4 years ago

using try...catch wasn't best idea since if there are a lot of DOMDocument::loadHTML() everything gets really slow.

the libxml_use_internal_errors(true) indicates that you're going to handle the errors and warnings ourselves and so they don'to mess up the output / slow down things.

This is not the same as the @ operator. The warnings get collected behind the scenes and afterwards you can retrieve them by using libxml_get_errors() in case you wish to perform logging or return the list of issues to the caller.

Whether or not you're using the collected warnings you should always clear the queue by calling libxml_clear_errors().

shweshi commented 4 years ago

@alinmiron Looks good to me.

shweshi commented 4 years ago

@alinmiron Log::warning() was not working with php 5.6, illuminate/log 6.0 requires php 7. Due to which tests cases were also failing. I have removed Log:: warning () for now till we can come up with something which doesn't break and requires package users to upgrade php version.