This question has been archived.

Error suppression ... surpressed?

November 12, 2014 1.2k views

Server Setup

  • Ubuntu 14.04
  • LAMP
  • Postfix
  • DoveCot
  • HTOP

I have a BB code script that is checking if the image exists, by attempting to use getimagesize() on the URL.

This works if the URL is a valid image, but if it's not* it errors.

  • Think photo bucket link where the image is within the page, but not direct link to the image

The exact line in the code is;

$image = @getimagesize($src);

Expected Result
With the PHP error suppression there, I expect the page to continue but catch it as a false, which I parse a result for.

Exact Error Given
PHP Warning: getimagesize(): phpnetworkgetaddresses: getaddrinfo failed: Name or service not known (2)
Action taken: Line executed: /var/www/html/forums.php:124z

Further Information
filegetcontents and curl seem to fail too;

Anybody have any suggestions on the cause?

I just did a little bit more testing quickly and it would appear that if I use a static URL, it works fine. The image URL's provided in the post actually redirect within the image hosting site, so it appears that it fails to accept the redirect and errors, crashing the page.

Using a simple inside the image tags returns "invalid image" as expected, so this has to be the redirect causing it.

Which still leaves me with the question; why will none of the functions mentioned above, allow error suppression?

Be the first one to answer this question.