Skip to content

Commit

Permalink
Merge pull request #142 from koriym/warning
Browse files Browse the repository at this point in the history
E_USER_WARNING when exception caught in ResourceObject::__toString()
  • Loading branch information
koriym authored Jul 19, 2018
2 parents adb7bd7 + 6167110 commit c2d214c
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion src/ResourceObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,8 @@ public function __toString()
try {
$view = $this->toString();
} catch (Exception $e) {
trigger_error($e->getMessage() . PHP_EOL . $e->getTraceAsString(), E_USER_ERROR);
$msg = sprintf("%s(%s)\n%s", get_class($e), $e->getMessage(), $e->getTraceAsString());
trigger_error($msg, E_USER_WARNING);

return '';
}
Expand Down
2 changes: 1 addition & 1 deletion tests/RequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -161,7 +161,7 @@ public function testToStringWithErrorRenderer()
$str = $errstr;
});
(string) $request;
$this->assertSame(256, $no);
$this->assertSame(E_USER_WARNING, $no);
$this->assertContains('FakeErrorRenderer->render', $str);
$this->assertSame('', (string) $request);
restore_error_handler();
Expand Down

0 comments on commit c2d214c

Please sign in to comment.