Skip to content

Commit

Permalink
Merge pull request #6 from daniellienert/bugfix/no-exception-in-tostring
Browse files Browse the repository at this point in the history
BUGFIX: __toString must not throw an exception
  • Loading branch information
grebaldi committed Nov 1, 2018
2 parents 8e910f3 + 7e74827 commit 462a6a8
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 462a6a8

Please sign in to comment.