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

Commit 13e1a63

Browse files
committed
[zendframework/zendframework#2210] Pass ErrorHandler::stop() result as 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.

File tree

1 file changed

+7
-9
lines changed

1 file changed

+7
-9
lines changed

src/AbstractContainer.php

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -351,18 +351,16 @@ public function __call($method, $arguments)
351351
{
352352
ErrorHandler::start(E_WARNING);
353353
$result = preg_match('/(find(?:One|All)?By)(.+)/', $method, $match);
354-
ErrorHandler::stop();
355-
if ($result) {
356-
return $this->{$match[1]}($match[2], $arguments[0]);
357-
}
358-
359-
throw new Exception\BadMethodCallException(
360-
sprintf(
354+
$error = ErrorHandler::stop();
355+
if (!$result) {
356+
throw new Exception\BadMethodCallException(sprintf(
361357
'Bad method call: Unknown method %s::%s',
362358
get_called_class(),
363359
$method
364-
)
365-
);
360+
), 0, $error);
361+
}
362+
return $this->{$match[1]}($match[2], $arguments[0]);
363+
366364
}
367365

368366
/**

0 commit comments

Comments
 (0)