Page Menu
Home
Phabricator
Search
Configure Global Search
Log In
Files
F15375995
D20143.id48087.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
1 KB
Referenced Files
None
Subscribers
None
D20143.id48087.diff
View Options
diff --git a/src/error/PhutilProxyException.php b/src/error/PhutilProxyException.php
--- a/src/error/PhutilProxyException.php
+++ b/src/error/PhutilProxyException.php
@@ -11,10 +11,15 @@
private $previousException;
- public function __construct($message, Exception $previous, $code = 0) {
+ public function __construct($message, $previous, $code = 0) {
$this->previousException = $previous;
- if (version_compare(PHP_VERSION, '5.3.0', '>=')) {
+ // This may be an "Exception" or a "Throwable". The "__construct()" method
+ // for the Exception is documented as taking an Exception, not a Throwable.
+ // Although passing a Throwable appears to work in PHP 7.3, don't risk it.
+ $is_exception = ($previous instanceof Exception);
+
+ if (version_compare(PHP_VERSION, '5.3.0', '>=') && $is_exception) {
parent::__construct($message, $code, $previous);
} else {
parent::__construct($message, $code);
diff --git a/src/error/phlog.php b/src/error/phlog.php
--- a/src/error/phlog.php
+++ b/src/error/phlog.php
@@ -21,7 +21,7 @@
foreach (func_get_args() as $event) {
$data = $metadata;
- if ($event instanceof Exception) {
+ if (($event instanceof Exception) || ($event instanceof Throwable)) {
$type = PhutilErrorHandler::EXCEPTION;
// If this is an exception, proxy it and generate a composite trace which
// shows both where the phlog() was called and where the exception was
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Fri, Mar 14, 1:09 AM (1 w, 1 d ago)
Storage Engine
blob
Storage Format
Encrypted (AES-256-CBC)
Storage Handle
7639323
Default Alt Text
D20143.id48087.diff (1 KB)
Attached To
Mode
D20143: Let "phlog()" log Throwables
Attached
Detach File
Event Timeline
Log In to Comment