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

Fix behaviour for empty external responses #167

Open
wants to merge 1 commit into
base: 1.x
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions lib/class.image.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ public static function loadExternal($uri){
// get the raw body response, ignore errors
$response = @$gateway->exec();

if($response === false){
if(!$response){
throw new Exception(sprintf('Error reading external image <code>%s</code>. Please check the URI.', $uri));
}

Expand All @@ -67,7 +67,7 @@ public static function loadExternal($uri){
// Symphony 2.4 enhances the TMP constant so it can be relied upon
$dest = tempnam(TMP, 'IMAGE');

if(!file_put_contents($dest, $response)) {
if(file_put_contents($dest, $response) === false) {
throw new Exception(sprintf('Error writing to temporary file <code>%s</code>.', $dest));
}

Expand Down