Skip to content
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

Fatal Error: Call to a member function name() on string #256

Open
mark-8 opened this issue Dec 14, 2020 · 3 comments · May be fixed by #257
Open

Fatal Error: Call to a member function name() on string #256

mark-8 opened this issue Dec 14, 2020 · 3 comments · May be fixed by #257

Comments

@mark-8
Copy link

mark-8 commented Dec 14, 2020

Hi,
Whilst parsing https://www.investmentweek.co.uk/news/4024910/asi-expands-sustainable-development-fund-range-em-launch

Fatal error: Uncaught Error: Call to a member function name() on string in \server\path\php-html-parser\src\PHPHtmlParser\Dom\Parser.php on line 40.

I believe it's failing on this tag <a tag="#&lt;SiteMetaDataProxy:0x007f593ebb6ba8&gt;" href="/tag/aberdeen-standard-investments">Aberdeen Standard Investments</a> - probably as a result of the 'tag' attribute.

Whilst I appreciate the source (out of our control) is the blame here, the fatal error crashes the whole process without a recovery mechanism.

The addition of a simple is_object( $activeNode->tag ) in the condition before the failure may be sufficient to resolve this, but I am not sufficiently familiar with the code to make that assertion.

@mark-8 mark-8 linked a pull request Dec 14, 2020 that will close this issue
@phattarachai
Copy link

Hi,
This library is easy to use, I appreciated it.

But I face the same problem as well. While I can replace the failing tag with str_replace(), it would be nice if the parser can handle the attribute without the fatal error.

Thanks.

@Sadikk
Copy link

Sadikk commented Aug 2, 2021

Also experiencing this

@phpfui
Copy link

phpfui commented Oct 7, 2021

This should be fixed by PR #289

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

4 participants