Skip to content
This repository has been archived by the owner on Jan 30, 2020. It is now read-only.

Commit

Permalink
[zendframework/zendframework#2210] Pass ErrorHandler::stop() result a…
Browse files Browse the repository at this point in the history
…s previous exception

- Per @mark-mabe
- Any place where an exception is throw immediately following an
  ErrorHandler::stop() call should pass the result of that call as the previous
  exception.
  • Loading branch information
Showing 1 changed file with 7 additions and 9 deletions.
16 changes: 7 additions & 9 deletions src/AbstractContainer.php
Original file line number Diff line number Diff line change
Expand Up @@ -351,18 +351,16 @@ public function __call($method, $arguments)
{
ErrorHandler::start(E_WARNING);
$result = preg_match('/(find(?:One|All)?By)(.+)/', $method, $match);
ErrorHandler::stop();
if ($result) {
return $this->{$match[1]}($match[2], $arguments[0]);
}

throw new Exception\BadMethodCallException(
sprintf(
$error = ErrorHandler::stop();
if (!$result) {
throw new Exception\BadMethodCallException(sprintf(
'Bad method call: Unknown method %s::%s',
get_called_class(),
$method
)
);
), 0, $error);
}
return $this->{$match[1]}($match[2], $arguments[0]);

}

/**
Expand Down

0 comments on commit 13e1a63

Please sign in to comment.