Skip to content

Commit

Permalink
BUGFIX: __toString must not throw an excaption
Browse files Browse the repository at this point in the history
When an image is not found due to security constraints, an exception is thrown
which is covered by PHPs exception that __toString should never throw an exception.
  • Loading branch information
daniellienert committed Oct 30, 2018
1 parent 8e910f3 commit 7e74827
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions Classes/EelHelpers/AbstractImageSourceHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -118,14 +118,17 @@ public function allowsCallOfMethod($methodName)
}
}


/**
* If the source is cast to string the default source is returned
*
* @return string
*/
public function __toString(): string
{
return $this->src();
try {
return $this->src();
} catch (\Exception $e) {
return $e->getMessage();
}
}
}

0 comments on commit 7e74827

Please sign in to comment.