Fix #262: Silenced errors won't fill error_get_last() array

This commit is contained in:
Matias Griese
2015-02-17 14:42:26 +02:00
parent 01f84f8121
commit fa66cb6c00
2 changed files with 26 additions and 1 deletions
+8 -1
View File
@@ -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;
}
/**
+18
View File
@@ -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