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

Catch ValueError coming from favicon lib in case of invalid redirects #2054

Closed
wants to merge 2 commits into from

Conversation

Grotax
Copy link
Member

@Grotax Grotax commented Jan 11, 2023

No description provided.

@Grotax Grotax linked an issue Jan 11, 2023 that may be closed by this pull request
3 tasks
Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
lib/Fetcher/FeedFetcher.php Outdated Show resolved Hide resolved
lib/Fetcher/FeedFetcher.php Outdated Show resolved Hide resolved
try {
return $this->faviconFactory->get($base_url);
} catch (\Error $e) {
//Actual error should be ValueError but that is only implemented in PHP 8+
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If it's only in PHP 8+, how can the factory use it? Aren't they using their own ValueError? Because otherwise it can't throw it either.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yea I think it's not their own ValueError, the lib doesn't define any Exceptions if I'm not wrong instead this error from the issue came from PHP itself. Which I guess depends on your PHP version.

The docs for the function that is throwing the error did not inlcude further information.

This should catch the error in php 8+ which the report was also based on and below that worst case the error is not caught because they used something else..

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we reproduce it somehow so I can trace and update it in the lib?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't know, the linked issue did have some hints on how it probably happens but for that you would need to miss misconfigure a Webserver on purpose, with an invalid redirect for the favicon.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be easier if we just find the feed where this happens. If we don't make this library more resiliant to errors we'll keep running into this.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

True but the reporter was apparently not able to name the affected feed. The feed that was mentioned there did not cause that error.

Signed-off-by: Benjamin Brahmer <info@b-brahmer.de>
@Grotax
Copy link
Member Author

Grotax commented Feb 10, 2023

Can we merge this?

#2082 is about the same issue but also provided no feed url, since the exception doesn't contain that.

@SMillerDev
Copy link
Contributor

I'm really worried to merge this since it essentially hides a fundamental problem in the library. To me that doesn't seem like a fix that will make our lives better.

@Grotax
Copy link
Member Author

Grotax commented Feb 10, 2023

OK how can we identify then the URLs that trigger this?

I have never seen this problem in my feeds and non-user so far provided a feed with this issue.

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 this pull request may close these issues.

ValueError: Path cannot be empty
2 participants