Files
Brandon Kelly a87c02c712 Fix more types (#19333)
* Migration::upsert() returns void

* Unneeded `@property` tags

* Add missing `null` param/return types

* Null types for db\Query + db\ActiveQuery

* Fixed testSelect

* Null types for Validator

* Several more null types

* One more

* Make AccessRule::$allow always a boolean

It doesn't have any special null handling, so it's safe to default to false

* Validator::$skipOnEmpty is always a boolean

* Catch all throwable from Widget::widget()

* Don't limit $previous args to \Exception

The actual \Exception allows $previous to be any throwable in PHP 7+

* Add Throwable catch block to Instance::get()

* Throwable cleanup

Comment changes only.

- Document \Throwable instead of \Exception wherever appropriate
- Removed redundant exception/error classes when \Throwable is referenced

* Yii::setlogger() accepts null

* ArrayHelper::removeValue() can remove any type of value

* Change default $allow value to false
2022-04-03 11:20:21 +02:00

91 lines
2.0 KiB
PHP

<?php
/* @var $exception \Throwable */
/* @var $handler \yii\web\ErrorHandler */
if ($exception instanceof \yii\web\HttpException) {
$code = $exception->statusCode;
} else {
$code = $exception->getCode();
}
$name = $handler->getExceptionName($exception);
if ($name === null) {
$name = 'Error';
}
if ($code) {
$name .= " (#$code)";
}
if ($exception instanceof \yii\base\UserException) {
$message = $exception->getMessage();
} else {
$message = 'An internal server error occurred.';
}
if (method_exists($this, 'beginPage')) {
$this->beginPage();
}
?>
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8" />
<title><?= $handler->htmlEncode($name) ?></title>
<style>
body {
font: normal 9pt "Verdana";
color: #000;
background: #fff;
}
h1 {
font: normal 18pt "Verdana";
color: #f00;
margin-bottom: .5em;
}
h2 {
font: normal 14pt "Verdana";
color: #800000;
margin-bottom: .5em;
}
h3 {
font: bold 11pt "Verdana";
}
p {
font: normal 9pt "Verdana";
color: #000;
}
.version {
color: gray;
font-size: 8pt;
border-top: 1px solid #aaa;
padding-top: 1em;
margin-bottom: 1em;
}
</style>
</head>
<body>
<h1><?= $handler->htmlEncode($name) ?></h1>
<h2><?= nl2br($handler->htmlEncode($message)) ?></h2>
<p>
The above error occurred while the Web server was processing your request.
</p>
<p>
Please contact us if you think this is a server error. Thank you.
</p>
<div class="version">
<?= date('Y-m-d H:i:s') ?>
</div>
<?php if (method_exists($this, 'endBody')): ?>
<?php $this->endBody() // to allow injecting code into body (mostly by Yii Debug Toolbar)?>
<?php endif ?>
</body>
</html>
<?php if (method_exists($this, 'endPage')): ?>
<?php $this->endPage() ?>
<?php endif ?>