Automattic / jetpack

Security, performance, marketing, and design tools — Jetpack is made by WordPress experts to make WP sites safer and faster, and help you grow your traffic.
https://jetpack.com/
Other
1.58k stars 797 forks source link

Tonesque: error when trying to get colors from an image returning a 404 #1672

Open jeherve opened 9 years ago

jeherve commented 9 years ago

If you try to use Tonesque with an image returning a 404 error, it outputs the following warnings:

<b>Warning</b>:  imagecreatefromjpeg(): php_network_getaddresses: getaddrinfo failed: Name or service not known in <b>/wp-content/plugins/jetpack/_inc/lib/tonesque.php</b> on line <b>45</b><br />
<br />
<b>Warning</b>:  imagecreatefromjpeg(http://www.hervedesign.com/wp-content/uploads/2008/10/2365824451_192c8f8088_o.jpg): failed to open stream: php_network_getaddresses: getaddrinfo failed: Name or service not known in <b>/wp-content/plugins/jetpack/_inc/lib/tonesque.php</b> on line <b>45</b><br />

Would it be possible to fail silently instead?

georgestephanis commented 9 years ago

Is this an internal call that references a url, or a third party theme/plugin using tonesque?

jeherve commented 9 years ago

It's a third-party plugin, color-posts. Do you think I should handle the 404 in my plugin (probably somewhere around here?

I do see some room for improvement in our code as well, though. We could check for 404s in Jetpack_PostImages::get_image, or in Tonesque?

georgestephanis commented 9 years ago

The plugin could just prepend an @ to the calls to avoid 404 errors. I'd be fine adding some error handling in to core in theory.

jeherve commented 8 years ago

Worth noting that this will happen for any errors. Here is the same problem with a 403: https://twitter.com/helenhousandi/status/768135636230471680

jeherve commented 8 years ago

Related discussion: https://github.com/Automattic/jetpack/pull/3742#discussion_r61244909

stale[bot] commented 6 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.

github-actions[bot] commented 3 years ago

This issue has been marked as stale. This happened because:

No further action is needed. But it's worth checking if this ticket has clear reproduction steps and it is still reproducible. Feel free to close this issue if you think it's not valid anymore — if you do, please add a brief explanation.