mirror of
https://github.com/filp/whoops.git
synced 2026-08-26 04:07:41 +00:00
Fix #262: Silenced errors won't fill error_get_last() array
This commit is contained in:
+8
-1
@@ -302,7 +302,8 @@ class Run
|
||||
* @param string $file
|
||||
* @param int $line
|
||||
*
|
||||
* @return bool|null
|
||||
* @return bool
|
||||
* @throws ErrorException
|
||||
*/
|
||||
public function handleError($level, $message, $file = null, $line = null)
|
||||
{
|
||||
@@ -322,7 +323,13 @@ class Run
|
||||
} else {
|
||||
$this->handleException($exception);
|
||||
}
|
||||
// Do not propagate errors which were already handled by Whoops.
|
||||
return true;
|
||||
}
|
||||
|
||||
// Propagate error to the next handler, allows error_get_last() to
|
||||
// work on silenced errors.
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
@@ -346,6 +346,24 @@ class RunTest extends TestCase
|
||||
$this->assertTrue(true);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Whoops\Run::handleError
|
||||
*/
|
||||
public function testGetSilencedError()
|
||||
{
|
||||
$run = $this->getRunInstance();
|
||||
$run->register();
|
||||
|
||||
$handler = $this->getHandler();
|
||||
$run->pushHandler($handler);
|
||||
|
||||
@strpos();
|
||||
|
||||
$error = error_get_last();
|
||||
|
||||
$this->assertTrue($error && strpos($error['message'], 'strpos()') !== false);
|
||||
}
|
||||
|
||||
/**
|
||||
* @covers Whoops\Run::handleException
|
||||
* @covers Whoops\Run::writeToOutput
|
||||
|
||||
Reference in New Issue
Block a user