クラス yii\web\ErrorHandler
ErrorHandler はキャッチされなかった PHP エラーと例外を処理します。
ErrorHandler は、エラーの性質とアプリケーションが実行されているモードに基づいて、適切なビューを使用してこれらのエラーを表示します。
ErrorHandler はデフォルトで yii\base\Application のアプリケーションコンポーネントとして構成されます。そのインスタンスには Yii::$app->errorHandler
を介してアクセスできます。
ErrorHandler の詳細および使用方法については、エラー処理に関するガイド記事を参照してください。
公開プロパティ
公開メソッド
保護されたメソッド
メソッド | 説明 | 定義元 |
---|---|---|
convertExceptionToArray() | 例外を配列に変換します。 | yii\web\ErrorHandler |
getTypeUrl() | 指定されたPHPの型/クラスの情報リンクURLを返します。 | yii\web\ErrorHandler |
handleFallbackExceptionMessage() | handleException()での例外処理中にスローされた例外を処理します。 | yii\base\ErrorHandler |
renderException() | 例外をレンダリングします。 | yii\web\ErrorHandler |
shouldRenderSimpleHtml() | yii\web\ErrorHandler |
イベント
イベント | 型 | 説明 | 定義元 |
---|---|---|---|
EVENT_SHUTDOWN | yii\base\Event | handleFatalError()を介してシャットダウン関数によってハンドラが呼び出されたときにトリガーされるイベント。(バージョン2.0.46から利用可能) | yii\base\ErrorHandler |
プロパティの詳細
例外とエラーのコールスタック要素を描画するためのビューファイルのパス。
エラーページに表示されるべきPHPの定義済み変数のリスト。変数は$GLOBALS
経由でアクセス可能である必要があることに注意してください。そうでない場合、表示されません。デフォルトは['_GET', '_POST', '_FILES', '_COOKIE', '_SESSION']
です。
renderRequest()も参照してください。
外部エラーを表示するために使用されるコントローラーアクションへのルート(例:site/error
)。アクション内で、Yii::$app->errorHandler->exception
を使用してエラー情報を取得できます。このプロパティのデフォルト値はnullであり、ErrorHandlerがエラー表示を処理することを意味します。
コールスタック情報のない例外をレンダリングするためのビューファイルのパス。
例外をレンダリングするためのビューファイルのパス。
表示されるトレースソースコード行の最大数。デフォルトは13です。
前の例外をレンダリングするためのビューファイルのパス。
置換されるプレースホルダーを含むトレース行。プレースホルダーは{file}、{line}、{text}であり、文字列は次のようになります。
ファイル: {file} - 行: {line} - テキスト: {text}
https://github.com/yiisoft/yii2-debug#open-files-in-ideも参照してください。
メソッドの詳細
定義場所: yii\base\Component::__call()
クラスメソッドではない名前付きメソッドを呼び出します。
このメソッドは、添付されたビヘイビアに指定されたメソッドがあるかどうかを確認し、利用可能な場合は実行します。
不明なメソッドが呼び出されたときに暗黙的に呼び出されるPHPのマジックメソッドであるため、このメソッドを直接呼び出さないでください。
public mixed __call ( $name, $params ) | ||
$name | string |
メソッド名 |
$params | array |
メソッドのパラメータ |
return | mixed |
メソッドの戻り値 |
---|---|---|
throws | yii\base\UnknownMethodException |
不明なメソッドを呼び出す場合 |
public function __call($name, $params)
{
$this->ensureBehaviors();
foreach ($this->_behaviors as $object) {
if ($object->hasMethod($name)) {
return call_user_func_array([$object, $name], $params);
}
}
throw new UnknownMethodException('Calling unknown method: ' . get_class($this) . "::$name()");
}
定義元: yii\base\Component::__clone()
このメソッドは、既存のオブジェクトを複製してオブジェクトが作成された後に呼び出されます。
古いオブジェクトにアタッチされているため、すべてのビヘイビアを削除します。
public void __clone ( ) |
public function __clone()
{
$this->_events = [];
$this->_eventWildcards = [];
$this->_behaviors = null;
}
定義元: yii\base\BaseObject::__construct()
コンストラクタ。
デフォルトの実装では2つのことを行います。
- 与えられた設定
$config
でオブジェクトを初期化します。 - init() を呼び出します。
このメソッドが子クラスでオーバーライドされている場合、以下の推奨事項があります。
- コンストラクタの最後のパラメータは、ここにある
$config
のような設定配列にすること。 - コンストラクタの最後に親の実装を呼び出すこと。
public void __construct ( $config = [] ) | ||
$config | array |
オブジェクトのプロパティを初期化するために使用される名前と値のペア |
public function __construct($config = [])
{
if (!empty($config)) {
Yii::configure($this, $config);
}
$this->init();
}
定義元: yii\base\Component::__get()
コンポーネントプロパティの値を返します。
このメソッドは以下の順序でチェックを行い、それに応じて処理します。
- ゲッターによって定義されたプロパティ: ゲッターの結果を返します
- ビヘイビアのプロパティ: ビヘイビアのプロパティ値を返します
$value = $component->property;
を実行すると暗黙的に呼び出される PHP のマジックメソッドであるため、このメソッドを直接呼び出さないでください。
__set() も参照してください。
public mixed __get ( $name ) | ||
$name | string |
プロパティ名 |
return | mixed |
プロパティの値、またはビヘイビアのプロパティの値 |
---|---|---|
throws | yii\base\UnknownPropertyException |
プロパティが定義されていない場合 |
throws | yii\base\InvalidCallException |
プロパティが書き込み専用の場合。 |
public function __get($name)
{
$getter = 'get' . $name;
if (method_exists($this, $getter)) {
// read property, e.g. getName()
return $this->$getter();
}
// behavior property
$this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) {
if ($behavior->canGetProperty($name)) {
return $behavior->$name;
}
}
if (method_exists($this, 'set' . $name)) {
throw new InvalidCallException('Getting write-only property: ' . get_class($this) . '::' . $name);
}
throw new UnknownPropertyException('Getting unknown property: ' . get_class($this) . '::' . $name);
}
定義元: yii\base\Component::__isset()
プロパティが設定されているか、つまり定義されていて null でないかを確認します。
このメソッドは以下の順序でチェックを行い、それに応じて処理します。
- セッターによって定義されたプロパティ: プロパティが設定されているかどうかを返します
- ビヘイビアのプロパティ: プロパティが設定されているかどうかを返します
- 存在しないプロパティの場合は
false
を返します
isset($component->property)
を実行すると暗黙的に呼び出される PHP のマジックメソッドであるため、このメソッドを直接呼び出さないでください。
public boolean __isset ( $name ) | ||
$name | string |
プロパティ名またはイベント名 |
return | boolean |
指定されたプロパティが設定されているかどうか |
---|
public function __isset($name)
{
$getter = 'get' . $name;
if (method_exists($this, $getter)) {
return $this->$getter() !== null;
}
// behavior property
$this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) {
if ($behavior->canGetProperty($name)) {
return $behavior->$name !== null;
}
}
return false;
}
定義元: yii\base\Component::__set()
コンポーネントプロパティの値を設定します。
このメソッドは以下の順序でチェックを行い、それに応じて処理します。
- セッターによって定義されたプロパティ: プロパティ値を設定します
- "on xyz" の形式のイベント: ハンドラをイベント "xyz" にアタッチします
- "as xyz" の形式のビヘイビア: "xyz" という名前のビヘイビアをアタッチします
- ビヘイビアのプロパティ: ビヘイビアのプロパティ値を設定します
$component->property = $value;
を実行すると暗黙的に呼び出される PHP のマジックメソッドであるため、このメソッドを直接呼び出さないでください。
__get() も参照してください。
public void __set ( $name, $value ) | ||
$name | string |
プロパティ名またはイベント名 |
$value | mixed |
プロパティの値 |
throws | yii\base\UnknownPropertyException |
プロパティが定義されていない場合 |
---|---|---|
throws | yii\base\InvalidCallException |
プロパティが読み取り専用の場合。 |
public function __set($name, $value)
{
$setter = 'set' . $name;
if (method_exists($this, $setter)) {
// set property
$this->$setter($value);
return;
} elseif (strncmp($name, 'on ', 3) === 0) {
// on event: attach event handler
$this->on(trim(substr($name, 3)), $value);
return;
} elseif (strncmp($name, 'as ', 3) === 0) {
// as behavior: attach behavior
$name = trim(substr($name, 3));
$this->attachBehavior($name, $value instanceof Behavior ? $value : Yii::createObject($value));
return;
}
// behavior property
$this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) {
if ($behavior->canSetProperty($name)) {
$behavior->$name = $value;
return;
}
}
if (method_exists($this, 'get' . $name)) {
throw new InvalidCallException('Setting read-only property: ' . get_class($this) . '::' . $name);
}
throw new UnknownPropertyException('Setting unknown property: ' . get_class($this) . '::' . $name);
}
定義元: yii\base\Component::__unset()
コンポーネントプロパティを null に設定します。
このメソッドは以下の順序でチェックを行い、それに応じて処理します。
- セッターによって定義されたプロパティ: プロパティ値を null に設定します
- ビヘイビアのプロパティ: プロパティ値を null に設定します
unset($component->property)
を実行すると暗黙的に呼び出される PHP のマジックメソッドであるため、このメソッドを直接呼び出さないでください。
public void __unset ( $name ) | ||
$name | string |
プロパティ名 |
throws | yii\base\InvalidCallException |
プロパティが読み取り専用の場合。 |
---|
public function __unset($name)
{
$setter = 'set' . $name;
if (method_exists($this, $setter)) {
$this->$setter(null);
return;
}
// behavior property
$this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) {
if ($behavior->canSetProperty($name)) {
$behavior->$name = null;
return;
}
}
throw new InvalidCallException('Unsetting an unknown or read-only property: ' . get_class($this) . '::' . $name);
}
指定された PHP 型/クラスへの情報リンクを追加します。
public string addTypeLinks ( $code ) | ||
$code | string |
リンク化されるタイプ/クラス名。 |
return | string |
HTML タイプ/クラス名でリンク化されます。 |
---|
public function addTypeLinks($code)
{
if (preg_match('/(.*?)::([^(]+)/', $code, $matches)) {
$class = $matches[1];
$method = $matches[2];
$text = $this->htmlEncode($class) . '::' . $this->htmlEncode($method);
} else {
$class = $code;
$method = null;
$text = $this->htmlEncode($class);
}
$url = null;
$shouldGenerateLink = true;
if ($method !== null && substr_compare($method, '{closure}', -9) !== 0) {
$reflection = new \ReflectionClass($class);
if ($reflection->hasMethod($method)) {
$reflectionMethod = $reflection->getMethod($method);
$shouldGenerateLink = $reflectionMethod->isPublic() || $reflectionMethod->isProtected();
} else {
$shouldGenerateLink = false;
}
}
if ($shouldGenerateLink) {
$url = $this->getTypeUrl($class, $method);
}
if ($url === null) {
return $text;
}
return '<a href="' . $url . '" target="_blank">' . $text . '</a>';
}
引数配列を文字列表現に変換します。
public string argumentsToString ( $args ) | ||
$args | array |
変換される引数配列 |
return | string |
引数配列の文字列表現 |
---|
public function argumentsToString($args)
{
$count = 0;
$isAssoc = $args !== array_values($args);
foreach ($args as $key => $value) {
$count++;
if ($count >= 5) {
if ($count > 5) {
unset($args[$key]);
} else {
$args[$key] = '...';
}
continue;
}
if (is_object($value)) {
$args[$key] = '<span class="title">' . $this->htmlEncode(get_class($value)) . '</span>';
} elseif (is_bool($value)) {
$args[$key] = '<span class="keyword">' . ($value ? 'true' : 'false') . '</span>';
} elseif (is_string($value)) {
$fullValue = $this->htmlEncode($value);
if (mb_strlen($value, 'UTF-8') > 32) {
$displayValue = $this->htmlEncode(mb_substr($value, 0, 32, 'UTF-8')) . '...';
$args[$key] = "<span class=\"string\" title=\"$fullValue\">'$displayValue'</span>";
} else {
$args[$key] = "<span class=\"string\">'$fullValue'</span>";
}
} elseif (is_array($value)) {
$args[$key] = '[' . $this->argumentsToString($value) . ']';
} elseif ($value === null) {
$args[$key] = '<span class="keyword">null</span>';
} elseif (is_resource($value)) {
$args[$key] = '<span class="keyword">resource</span>';
} else {
$args[$key] = '<span class="number">' . $value . '</span>';
}
if (is_string($key)) {
$args[$key] = '<span class="string">\'' . $this->htmlEncode($key) . "'</span> => $args[$key]";
} elseif ($isAssoc) {
$args[$key] = "<span class=\"number\">$key</span> => $args[$key]";
}
}
return implode(', ', $args);
}
定義元: yii\base\Component::attachBehavior()
ビヘイビアをこのコンポーネントにアタッチします。
このメソッドは、与えられた設定に基づいてビヘイビアオブジェクトを作成します。その後、yii\base\Behavior::attach() メソッドを呼び出して、ビヘイビアオブジェクトがこのコンポーネントにアタッチされます。
detachBehavior() も参照してください。
public yii\base\Behavior attachBehavior ( $name, $behavior ) | ||
$name | string |
ビヘイビアの名前。 |
$behavior | string|array|yii\base\Behavior |
ビヘイビアの設定。これは次のいずれかです。
|
return | yii\base\Behavior |
ビヘイビアオブジェクト |
---|
public function attachBehavior($name, $behavior)
{
$this->ensureBehaviors();
return $this->attachBehaviorInternal($name, $behavior);
}
定義元: yii\base\Component::attachBehaviors()
コンポーネントにビヘイビアのリストをアタッチします。
各ビヘイビアは、その名前でインデックスされ、yii\base\Behavior オブジェクト、ビヘイビアクラスを指定する文字列、またはビヘイビアを作成するための構成配列である必要があります。
attachBehavior() も参照してください。
public void attachBehaviors ( $behaviors ) | ||
$behaviors | array |
コンポーネントにアタッチされるビヘイビアのリスト |
public function attachBehaviors($behaviors)
{
$this->ensureBehaviors();
foreach ($behaviors as $name => $behavior) {
$this->attachBehaviorInternal($name, $behavior);
}
}
定義元: yii\base\Component::behaviors()
このコンポーネントが動作するはずのビヘイビアのリストを返します。
子クラスは、このメソッドをオーバーライドして、それらがどのように振る舞うかを指定できます。
このメソッドの戻り値は、ビヘイビアオブジェクト、またはビヘイビア名でインデックスされた設定の配列である必要があります。ビヘイビアの設定は、ビヘイビアクラスを指定する文字列か、次の構造の配列のいずれかになります。
'behaviorName' => [
'class' => 'BehaviorClass',
'property1' => 'value1',
'property2' => 'value2',
]
ビヘイビアクラスは、yii\base\Behavior を継承する必要があることに注意してください。ビヘイビアは、名前付きまたは匿名でアタッチできます。配列キーとして名前が使用される場合、この名前を使用して、後で getBehavior() を使用してビヘイビアを取得したり、detachBehavior() を使用してデタッチしたりできます。匿名ビヘイビアは、取得またはデタッチできません。
このメソッドで宣言されたビヘイビアは、自動的に(必要に応じて)コンポーネントにアタッチされます。
public array behaviors ( ) | ||
return | array |
ビヘイビアの構成。 |
---|
public function behaviors()
{
return [];
}
定義元: yii\base\Component::canGetProperty()
プロパティを読み取ることができるかどうかを示す値を返します。
プロパティは、次のいずれかの場合に読み取り可能です。
- クラスが、指定された名前に関連付けられたゲッターメソッドを持っている場合(この場合、プロパティ名は大小文字を区別しません)。
- クラスが、指定された名前のメンバ変数を持っている場合(
$checkVars
が true の場合)。 - アタッチされたビヘイビアが、指定された名前の読み取り可能なプロパティを持っている場合(
$checkBehaviors
が true の場合)。
canSetProperty() も参照してください。
public boolean canGetProperty ( $name, $checkVars = true, $checkBehaviors = true ) | ||
$name | string |
プロパティ名 |
$checkVars | boolean |
メンバ変数をプロパティとして扱うかどうか |
$checkBehaviors | boolean |
ビヘイビアのプロパティをこのコンポーネントのプロパティとして扱うかどうか |
return | boolean |
プロパティが読み取り可能かどうか |
---|
public function canGetProperty($name, $checkVars = true, $checkBehaviors = true)
{
if (method_exists($this, 'get' . $name) || $checkVars && property_exists($this, $name)) {
return true;
} elseif ($checkBehaviors) {
$this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) {
if ($behavior->canGetProperty($name, $checkVars)) {
return true;
}
}
}
return false;
}
定義元: yii\base\Component::canSetProperty()
プロパティを設定できるかどうかを示す値を返します。
プロパティは、次のいずれかの場合に書き込み可能です。
- クラスが、指定された名前に関連付けられたセッターメソッドを持っている場合(この場合、プロパティ名は大小文字を区別しません)。
- クラスが、指定された名前のメンバ変数を持っている場合(
$checkVars
が true の場合)。 - アタッチされたビヘイビアが、指定された名前の書き込み可能なプロパティを持っている場合(
$checkBehaviors
が true の場合)。
canGetProperty() も参照してください。
public boolean canSetProperty ( $name, $checkVars = true, $checkBehaviors = true ) | ||
$name | string |
プロパティ名 |
$checkVars | boolean |
メンバ変数をプロパティとして扱うかどうか |
$checkBehaviors | boolean |
ビヘイビアのプロパティをこのコンポーネントのプロパティとして扱うかどうか |
return | boolean |
プロパティが書き込み可能かどうか |
---|
public function canSetProperty($name, $checkVars = true, $checkBehaviors = true)
{
if (method_exists($this, 'set' . $name) || $checkVars && property_exists($this, $name)) {
return true;
} elseif ($checkBehaviors) {
$this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) {
if ($behavior->canSetProperty($name, $checkVars)) {
return true;
}
}
}
return false;
}
::class
を使用してください。
定義元: yii\base\BaseObject::className()
このクラスの完全修飾名を返します。
public static string className ( ) | ||
return | string |
このクラスの完全修飾名。 |
---|
public static function className()
{
return get_called_class();
}
定義元: yii\base\ErrorHandler::clearOutput()
このメソッドを呼び出す前にエコーされたすべての出力を削除します。
public void clearOutput ( ) |
public function clearOutput()
{
// the following manual level counting is to deal with zlib.output_compression set to On
for ($level = ob_get_level(); $level > 0; --$level) {
if (!@ob_end_clean()) {
ob_clean();
}
}
}
例外を配列に変換します。
protected array convertExceptionToArray ( $exception ) | ||
$exception | Throwable |
変換される例外 |
return | array |
例外の配列表現。 |
---|
protected function convertExceptionToArray($exception)
{
if (!YII_DEBUG && !$exception instanceof UserException && !$exception instanceof HttpException) {
$exception = new HttpException(500, Yii::t('yii', 'An internal server error occurred.'));
}
$array = [
'name' => ($exception instanceof Exception || $exception instanceof ErrorException) ? $exception->getName() : 'Exception',
'message' => $exception->getMessage(),
'code' => $exception->getCode(),
];
if ($exception instanceof HttpException) {
$array['status'] = $exception->statusCode;
}
if (YII_DEBUG) {
$array['type'] = get_class($exception);
if (!$exception instanceof UserException) {
$array['file'] = $exception->getFile();
$array['line'] = $exception->getLine();
$array['stack-trace'] = explode("\n", $exception->getTraceAsString());
if ($exception instanceof \yii\db\Exception) {
$array['error-info'] = $exception->errorInfo;
}
}
}
if (($prev = $exception->getPrevious()) !== null) {
$array['previous'] = $this->convertExceptionToArray($prev);
}
return $array;
}
定義元: yii\base\ErrorHandler::convertExceptionToError()
例外を PHP エラーに変換します。
このメソッドは、__toString()
のようなメソッド内の例外を PHP エラーに変換するために使用できます。なぜなら、それらの中で例外をスローすることはできないからです。
public static never convertExceptionToError ( $exception ) | ||
$exception | Throwable |
PHP エラーに変換する例外。 |
public static function convertExceptionToError($exception)
{
trigger_error(static::convertExceptionToString($exception), E_USER_ERROR);
}
定義元: yii\base\ErrorHandler::convertExceptionToString()
例外を単純な文字列に変換します。
public static string convertExceptionToString ( $exception ) | ||
$exception | Throwable |
変換される例外 |
return | string |
例外の文字列表現。 |
---|
public static function convertExceptionToString($exception)
{
if ($exception instanceof UserException) {
return "{$exception->getName()}: {$exception->getMessage()}";
}
if (YII_DEBUG) {
return static::convertExceptionToVerboseString($exception);
}
return 'An internal server error occurred.';
}
定義元: yii\base\ErrorHandler::convertExceptionToVerboseString()
例外とそのトレースに関する詳細な情報を持つ文字列に例外を変換します。
public static string convertExceptionToVerboseString ( $exception ) | ||
$exception | Throwable |
変換される例外 |
return | string |
例外の文字列表現。 |
---|
public static function convertExceptionToVerboseString($exception)
{
if ($exception instanceof Exception) {
$message = "Exception ({$exception->getName()})";
} elseif ($exception instanceof ErrorException) {
$message = (string)$exception->getName();
} else {
$message = 'Exception';
}
$message .= " '" . get_class($exception) . "' with message '{$exception->getMessage()}' \n\nin "
. $exception->getFile() . ':' . $exception->getLine() . "\n\n"
. "Stack trace:\n" . $exception->getTraceAsString();
return $message;
}
フレームワークの現在のバージョンとバージョン番号テキストを含むページを参照する HTML リンクを含む文字列を作成します。
public string createFrameworkVersionLink ( ) | ||
return | string |
フレームワークのバージョン情報ハイパーリンク。 |
---|
public function createFrameworkVersionLink()
{
return '<a href="https://github.com/yiisoft/yii2/" target="_blank">' . $this->htmlEncode(Yii::getVersion()) . '</a>';
}
指定された HTTP ステータスコードに関する情報を含むページへのリンクを含む HTML を作成します。
public string createHttpStatusLink ( $statusCode, $statusDescription ) | ||
$statusCode | integer |
情報リンクを生成するために使用します。 |
$statusDescription | string |
ステータスコードの後に表示する説明。 |
return | string |
HTTPステータスコード情報を含む生成されたHTML。 |
---|
public function createHttpStatusLink($statusCode, $statusDescription)
{
return '<a href="https://en.wikipedia.org/wiki/List_of_HTTP_status_codes#' . (int) $statusCode . '" target="_blank">HTTP ' . (int) $statusCode . ' – ' . $statusDescription . '</a>';
}
決定された Web サーバーソフトウェアのホームページとそのフルネームを参照する HTML リンクを含む文字列を作成します。
public string createServerInformationLink ( ) | ||
return | string |
サーバーソフトウェア情報ハイパーリンク。 |
---|
public function createServerInformationLink()
{
$serverUrls = [
'https://httpd.apache.org/' => ['apache'],
'https://nginx.dokyumento.jp/' => ['nginx'],
'https://www.lighttpd.net/' => ['lighttpd'],
'http://gwan.com/' => ['g-wan', 'gwan'],
'https://www.iis.net/' => ['iis', 'services'],
'https://www.php.net/manual/en/features.commandline.webserver.php' => ['development'],
];
if (isset($_SERVER['SERVER_SOFTWARE'])) {
foreach ($serverUrls as $url => $keywords) {
foreach ($keywords as $keyword) {
if (stripos($_SERVER['SERVER_SOFTWARE'], $keyword) !== false) {
return '<a href="' . $url . '" target="_blank">' . $this->htmlEncode($_SERVER['SERVER_SOFTWARE']) . '</a>';
}
}
}
}
return '';
}
定義元: yii\base\Component::detachBehavior()
コンポーネントからビヘイビアをデタッチします。
ビヘイビアのyii\base\Behavior::detach()メソッドが呼び出されます。
public yii\base\Behavior|null detachBehavior ( $name ) | ||
$name | string |
ビヘイビアの名前。 |
return | yii\base\Behavior|null |
切り離されたビヘイビア。ビヘイビアが存在しない場合はNull。 |
---|
public function detachBehavior($name)
{
$this->ensureBehaviors();
if (isset($this->_behaviors[$name])) {
$behavior = $this->_behaviors[$name];
unset($this->_behaviors[$name]);
$behavior->detach();
return $behavior;
}
return null;
}
定義元: yii\base\Component::detachBehaviors()
コンポーネントからすべてのビヘイビアをデタッチします。
public void detachBehaviors ( ) |
public function detachBehaviors()
{
$this->ensureBehaviors();
foreach ($this->_behaviors as $name => $behavior) {
$this->detachBehavior($name);
}
}
定義元: yii\base\Component::ensureBehaviors()
behaviors() で宣言されたビヘイビアがこのコンポーネントにアタッチされていることを確認します。
public void ensureBehaviors ( ) |
public function ensureBehaviors()
{
if ($this->_behaviors === null) {
$this->_behaviors = [];
foreach ($this->behaviors() as $name => $behavior) {
$this->attachBehaviorInternal($name, $behavior);
}
}
}
定義元: yii\base\Component::getBehavior()
名前付きビヘイビアオブジェクトを返します。
public yii\base\Behavior|null getBehavior ( $name ) | ||
$name | string |
ビヘイビア名 |
return | yii\base\Behavior|null |
ビヘイビアオブジェクト。ビヘイビアが存在しない場合はnull |
---|
public function getBehavior($name)
{
$this->ensureBehaviors();
return isset($this->_behaviors[$name]) ? $this->_behaviors[$name] : null;
}
定義元: yii\base\Component::getBehaviors()
このコンポーネントにアタッチされているすべてのビヘイビアを返します。
public yii\base\Behavior[] getBehaviors ( ) | ||
return | yii\base\Behavior[] |
このコンポーネントにアタッチされているビヘイビアのリスト |
---|
public function getBehaviors()
{
$this->ensureBehaviors();
return $this->_behaviors;
}
人間が読める例外名を返します。
public string|null getExceptionName ( $exception ) | ||
$exception | Throwable | |
return | string|null |
人間が読める例外名。決定できない場合はnull |
---|
public function getExceptionName($exception)
{
if ($exception instanceof \yii\base\Exception || $exception instanceof \yii\base\InvalidCallException || $exception instanceof \yii\base\InvalidParamException || $exception instanceof \yii\base\UnknownMethodException) {
return $exception->getName();
}
return null;
}
指定されたPHPの型/クラスの情報リンクURLを返します。
こちらも参照 addTypeLinks().
protected string|null getTypeUrl ( $class, $method ) | ||
$class | string |
タイプまたはクラス名。 |
$method | string|null |
メソッド名。 |
return | string|null |
情報リンクURL。 |
---|
protected function getTypeUrl($class, $method)
{
if (strncmp($class, 'yii\\', 4) !== 0) {
return null;
}
$page = $this->htmlEncode(strtolower(str_replace('\\', '-', $class)));
$url = "https://yii.dokyumento.jp/doc-2.0/$page.html";
if ($method) {
$url .= "#$method()-detail";
}
return $url;
}
定義元: yii\base\ErrorHandler::handleError()
警告や通知などの PHP 実行エラーを処理します。
このメソッドはPHPエラーハンドラとして使用されます。単にyii\base\ErrorExceptionを発生させます。
public boolean handleError ( $code, $message, $file, $line ) | ||
$code | integer |
発生したエラーのレベル。 |
$message | string |
エラーメッセージ。 |
$file | string |
エラーが発生したファイル名。 |
$line | integer |
エラーが発生した行番号。 |
return | boolean |
通常のエラーハンドラが継続するかどうか。 |
---|---|---|
throws | yii\base\ErrorException |
public function handleError($code, $message, $file, $line)
{
if (error_reporting() & $code) {
// load ErrorException manually here because autoloading them will not work
// when error occurs while autoloading a class
if (!class_exists('yii\\base\\ErrorException', false)) {
require_once __DIR__ . '/ErrorException.php';
}
$exception = new ErrorException($message, $code, $code, $file, $line);
if (PHP_VERSION_ID < 70400) {
// prior to PHP 7.4 we can't throw exceptions inside of __toString() - it will result a fatal error
$trace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
array_shift($trace);
foreach ($trace as $frame) {
if ($frame['function'] === '__toString') {
$this->handleException($exception);
if (defined('HHVM_VERSION')) {
flush();
}
exit(1);
}
}
}
throw $exception;
}
return false;
}
public void handleException ( $exception ) | ||
$exception | Throwable |
キャッチされなかった例外 |
public function handleException($exception)
{
if ($exception instanceof ExitException) {
return;
}
$this->exception = $exception;
// disable error capturing to avoid recursive errors while handling exceptions
$this->unregister();
// set preventive HTTP status code to 500 in case error handling somehow fails and headers are sent
// HTTP exceptions will override this value in renderException()
if (PHP_SAPI !== 'cli') {
http_response_code(500);
}
try {
$this->logException($exception);
if ($this->discardExistingOutput) {
$this->clearOutput();
}
$this->renderException($exception);
if (!$this->silentExitOnException) {
\Yii::getLogger()->flush(true);
if (defined('HHVM_VERSION')) {
flush();
}
exit(1);
}
} catch (\Exception $e) {
// an other exception could be thrown while displaying the exception
$this->handleFallbackExceptionMessage($e, $exception);
} catch (\Throwable $e) {
// additional check for \Throwable introduced in PHP 7
$this->handleFallbackExceptionMessage($e, $exception);
}
$this->exception = null;
}
定義元: yii\base\ErrorHandler::handleFallbackExceptionMessage()
handleException()での例外処理中にスローされた例外を処理します。
protected void handleFallbackExceptionMessage ( $exception, $previousException ) | ||
$exception | Throwable |
メインの例外処理中にスローされた例外。 |
$previousException | Throwable |
handleException()で処理されたメインの例外。 |
protected function handleFallbackExceptionMessage($exception, $previousException)
{
$msg = "An Error occurred while handling another error:\n";
$msg .= (string) $exception;
$msg .= "\nPrevious exception:\n";
$msg .= (string) $previousException;
if (YII_DEBUG) {
if (PHP_SAPI === 'cli') {
echo $msg . "\n";
} else {
echo '<pre>' . htmlspecialchars($msg, ENT_QUOTES, Yii::$app->charset) . '</pre>';
}
$msg .= "\n\$_SERVER = " . VarDumper::export($_SERVER);
} else {
echo 'An internal server error occurred.';
}
error_log($msg);
if (defined('HHVM_VERSION')) {
flush();
}
exit(1);
}
定義元: yii\base\ErrorHandler::handleFatalError()
致命的な PHP エラーを処理します。
public void handleFatalError ( ) |
public function handleFatalError()
{
unset($this->_memoryReserve);
if (isset($this->_workingDirectory)) {
// fix working directory for some Web servers e.g. Apache
chdir($this->_workingDirectory);
// flush memory
unset($this->_workingDirectory);
}
$error = error_get_last();
if ($error === null) {
return;
}
// load ErrorException manually here because autoloading them will not work
// when error occurs while autoloading a class
if (!class_exists('yii\\base\\ErrorException', false)) {
require_once __DIR__ . '/ErrorException.php';
}
if (!ErrorException::isFatalError($error)) {
return;
}
if (!empty($this->_hhvmException)) {
$this->exception = $this->_hhvmException;
} else {
$this->exception = new ErrorException(
$error['message'],
$error['type'],
$error['type'],
$error['file'],
$error['line']
);
}
unset($error);
$this->logException($this->exception);
if ($this->discardExistingOutput) {
$this->clearOutput();
}
$this->renderException($this->exception);
// need to explicitly flush logs because exit() next will terminate the app immediately
Yii::getLogger()->flush(true);
if (defined('HHVM_VERSION')) {
flush();
}
$this->trigger(static::EVENT_SHUTDOWN);
// ensure it is called after user-defined shutdown functions
register_shutdown_function(function () {
exit(1);
});
}
定義元: yii\base\ErrorHandler::handleHhvmError()
警告や通知などの HHVM 実行エラーを処理します。
このメソッドは HHVM エラーハンドラーとして使用されます。これは、致命的なエラーハンドラーで使用される例外を保存します。
public boolean handleHhvmError ( $code, $message, $file, $line, $context, $backtrace ) | ||
$code | integer |
発生したエラーのレベル。 |
$message | string |
エラーメッセージ。 |
$file | string |
エラーが発生したファイル名。 |
$line | integer |
エラーが発生した行番号。 |
$context | mixed | |
$backtrace | mixed |
エラーのトレース |
return | boolean |
通常のエラーハンドラが継続するかどうか。 |
---|---|---|
throws | yii\base\ErrorException |
public function handleHhvmError($code, $message, $file, $line, $context, $backtrace)
{
if ($this->handleError($code, $message, $file, $line)) {
return true;
}
if (E_ERROR & $code) {
$exception = new ErrorException($message, $code, $code, $file, $line);
$ref = new \ReflectionProperty('\Exception', 'trace');
$ref->setAccessible(true);
$ref->setValue($exception, $backtrace);
$this->_hhvmException = $exception;
}
return false;
}
定義元: yii\base\Component::hasEventHandlers()
名前付きイベントにアタッチされたハンドラーがあるかどうかを示す値を返します。
public boolean hasEventHandlers ( $name ) | ||
$name | string |
イベント名 |
return | boolean |
イベントにアタッチされたハンドラーがあるかどうか。 |
---|
public function hasEventHandlers($name)
{
$this->ensureBehaviors();
if (!empty($this->_events[$name])) {
return true;
}
foreach ($this->_eventWildcards as $wildcard => $handlers) {
if (!empty($handlers) && StringHelper::matchWildcard($wildcard, $name)) {
return true;
}
}
return Event::hasHandlers($this, $name);
}
定義元: yii\base\Component::hasMethod()
メソッドが定義されているかどうかを示す値を返します。
メソッドが定義されている場合
- クラスに指定された名前のメソッドがある場合
- アタッチされたビヘイビアに指定された名前のメソッドがある場合 (
$checkBehaviors
が true の場合)。
public boolean hasMethod ( $name, $checkBehaviors = true ) | ||
$name | string |
プロパティ名 |
$checkBehaviors | boolean |
ビヘイビアのメソッドをこのコンポーネントのメソッドとして扱うかどうか |
return | boolean |
メソッドが定義されているかどうか |
---|
public function hasMethod($name, $checkBehaviors = true)
{
if (method_exists($this, $name)) {
return true;
} elseif ($checkBehaviors) {
$this->ensureBehaviors();
foreach ($this->_behaviors as $behavior) {
if ($behavior->hasMethod($name)) {
return true;
}
}
}
return false;
}
定義元: yii\base\Component::hasProperty()
このコンポーネントにプロパティが定義されているかどうかを示す値を返します。
プロパティが定義されている場合
- クラスに指定された名前に関連付けられたゲッターまたはセッターメソッドがある場合 (この場合、プロパティ名は大小文字を区別しません)。
- クラスが、指定された名前のメンバ変数を持っている場合(
$checkVars
が true の場合)。 - アタッチされたビヘイビアに指定された名前のプロパティがある場合 (
$checkBehaviors
が true の場合)。
参考
public boolean hasProperty ( $name, $checkVars = true, $checkBehaviors = true ) | ||
$name | string |
プロパティ名 |
$checkVars | boolean |
メンバ変数をプロパティとして扱うかどうか |
$checkBehaviors | boolean |
ビヘイビアのプロパティをこのコンポーネントのプロパティとして扱うかどうか |
return | boolean |
プロパティが定義されているかどうか |
---|
public function hasProperty($name, $checkVars = true, $checkBehaviors = true)
{
return $this->canGetProperty($name, $checkVars, $checkBehaviors) || $this->canSetProperty($name, false, $checkBehaviors);
}
特殊文字を HTML エンティティに変換します。
public string htmlEncode ( $text ) | ||
$text | string |
エンコードするテキスト。 |
return | string |
エンコードされた元のテキスト。 |
---|
public function htmlEncode($text)
{
return htmlspecialchars($text, ENT_NOQUOTES | ENT_SUBSTITUTE | ENT_HTML5, 'UTF-8');
}
public void init ( ) |
public function init()
{
$this->silentExitOnException = $this->silentExitOnException !== null ? $this->silentExitOnException : YII_ENV_TEST;
parent::init();
}
指定されたファイル名がフレームワークに属するかどうかを判断します。
public boolean isCoreFile ( $file ) | ||
$file | string |
チェックする名前。 |
return | boolean |
指定されたファイル名がフレームワークに属するかどうか。 |
---|
public function isCoreFile($file)
{
return $file === null || strpos(realpath($file), YII2_PATH . DIRECTORY_SEPARATOR) === 0;
}
定義元: yii\base\ErrorHandler::logException()
指定された例外をログに記録します。
public void logException ( $exception ) | ||
$exception | Throwable |
ログに記録する例外 |
バージョン | 説明 |
---|---|
2.0.3 | このメソッドは現在 public です。 |
public function logException($exception)
{
$category = get_class($exception);
if ($exception instanceof HttpException) {
$category = 'yii\\web\\HttpException:' . $exception->statusCode;
} elseif ($exception instanceof \ErrorException) {
$category .= ':' . $exception->getSeverity();
}
Yii::error($exception, $category);
}
定義元: yii\base\Component::off()
既存のイベントハンドラーをこのコンポーネントからデタッチします。
このメソッドは on() の反対です。
注: イベント名にワイルドカードパターンが渡された場合、このワイルドカードで登録されたハンドラーのみが削除され、このワイルドカードに一致するプレーン名で登録されたハンドラーは残ります。
参考 on()。
public boolean off ( $name, $handler = null ) | ||
$name | string |
イベント名 |
$handler | callable|null |
削除するイベントハンドラー。null の場合、指定されたイベントにアタッチされたすべてのハンドラーが削除されます。 |
return | boolean |
ハンドラーが見つかってデタッチされた場合 |
---|
public function off($name, $handler = null)
{
$this->ensureBehaviors();
if (empty($this->_events[$name]) && empty($this->_eventWildcards[$name])) {
return false;
}
if ($handler === null) {
unset($this->_events[$name], $this->_eventWildcards[$name]);
return true;
}
$removed = false;
// plain event names
if (isset($this->_events[$name])) {
foreach ($this->_events[$name] as $i => $event) {
if ($event[0] === $handler) {
unset($this->_events[$name][$i]);
$removed = true;
}
}
if ($removed) {
$this->_events[$name] = array_values($this->_events[$name]);
return true;
}
}
// wildcard event names
if (isset($this->_eventWildcards[$name])) {
foreach ($this->_eventWildcards[$name] as $i => $event) {
if ($event[0] === $handler) {
unset($this->_eventWildcards[$name][$i]);
$removed = true;
}
}
if ($removed) {
$this->_eventWildcards[$name] = array_values($this->_eventWildcards[$name]);
// remove empty wildcards to save future redundant regex checks:
if (empty($this->_eventWildcards[$name])) {
unset($this->_eventWildcards[$name]);
}
}
}
return $removed;
}
イベントハンドラーをイベントにアタッチします。
イベントハンドラは、有効なPHPのコールバックである必要があります。以下にいくつかの例を示します。
function ($event) { ... } // anonymous function
[$object, 'handleClick'] // $object->handleClick()
['Page', 'handleClick'] // Page::handleClick()
'handleClick' // global function handleClick()
イベントハンドラは、次のシグネチャで定義する必要があります。
function ($event)
ここで、$event
はイベントに関連付けられたパラメータを含む yii\base\Event オブジェクトです。
2.0.14 以降、イベント名をワイルドカードパターンとして指定できます。
$component->on('event.group.*', function ($event) {
Yii::trace($event->name . ' is triggered.');
});
off() も参照してください。
public void on ( $name, $handler, $data = null, $append = true ) | ||
$name | string |
イベント名 |
$handler | callable |
イベントハンドラ |
$data | mixed |
イベントがトリガーされたときにイベントハンドラに渡されるデータ。イベントハンドラが呼び出されたとき、このデータは yii\base\Event::$data を介してアクセスできます。 |
$append | boolean |
既存のハンドラリストの末尾に新しいイベントハンドラを追加するかどうか。false の場合、新しいハンドラは既存のハンドラリストの先頭に挿入されます。 |
public function on($name, $handler, $data = null, $append = true)
{
$this->ensureBehaviors();
if (strpos($name, '*') !== false) {
if ($append || empty($this->_eventWildcards[$name])) {
$this->_eventWildcards[$name][] = [$handler, $data];
} else {
array_unshift($this->_eventWildcards[$name], [$handler, $data]);
}
return;
}
if ($append || empty($this->_events[$name])) {
$this->_events[$name][] = [$handler, $data];
} else {
array_unshift($this->_events[$name], [$handler, $data]);
}
}
定義元: yii\base\ErrorHandler::register()
このエラーハンドラーを登録します。
public void register ( ) |
バージョン | 説明 |
---|---|
2.0.32 | エラーハンドラが既に登録されている場合、これは何も行いません。 |
public function register()
{
if (!$this->_registered) {
ini_set('display_errors', false);
set_exception_handler([$this, 'handleException']);
if (defined('HHVM_VERSION')) {
set_error_handler([$this, 'handleHhvmError']);
} else {
set_error_handler([$this, 'handleError']);
}
if ($this->memoryReserveSize > 0) {
$this->_memoryReserve = str_repeat('x', $this->memoryReserveSize);
}
// to restore working directory in shutdown handler
if (PHP_SAPI !== 'cli') {
$this->_workingDirectory = getcwd();
}
register_shutdown_function([$this, 'handleFatalError']);
$this->_registered = true;
}
}
コールスタックをレンダリングします。
public string renderCallStack ( $exception ) | ||
$exception | Throwable |
コールスタックを取得する例外 |
return | string |
レンダリングされたコールスタックのHTMLコンテンツ。 |
---|
public function renderCallStack($exception)
{
$out = '<ul>';
$out .= $this->renderCallStackItem($exception->getFile(), $exception->getLine(), null, null, [], 1);
for ($i = 0, $trace = $exception->getTrace(), $length = count($trace); $i < $length; ++$i) {
$file = !empty($trace[$i]['file']) ? $trace[$i]['file'] : null;
$line = !empty($trace[$i]['line']) ? $trace[$i]['line'] : null;
$class = !empty($trace[$i]['class']) ? $trace[$i]['class'] : null;
$function = null;
if (!empty($trace[$i]['function']) && $trace[$i]['function'] !== 'unknown') {
$function = $trace[$i]['function'];
}
$args = !empty($trace[$i]['args']) ? $trace[$i]['args'] : [];
$out .= $this->renderCallStackItem($file, $line, $class, $function, $args, $i + 2);
}
$out .= '</ul>';
return $out;
}
単一のコールスタック要素をレンダリングします。
public string renderCallStackItem ( $file, $line, $class, $method, $args, $index ) | ||
$file | string|null |
呼び出しが発生した場所の名前。 |
$line | integer|null |
呼び出しが発生した行番号。 |
$class | string|null |
呼び出されたクラス名。 |
$method | string|null |
呼び出された関数/メソッド名。 |
$args | array |
メソッド引数の配列。 |
$index | integer |
コールスタック要素の番号。 |
return | string |
レンダリングされたコールスタック要素のHTMLコンテンツ。 |
---|
public function renderCallStackItem($file, $line, $class, $method, $args, $index)
{
$lines = [];
$begin = $end = 0;
if ($file !== null && $line !== null) {
$line--; // adjust line number from one-based to zero-based
$lines = @file($file);
if ($line < 0 || $lines === false || ($lineCount = count($lines)) < $line) {
return '';
}
$half = (int) (($index === 1 ? $this->maxSourceLines : $this->maxTraceSourceLines) / 2);
$begin = $line - $half > 0 ? $line - $half : 0;
$end = $line + $half < $lineCount ? $line + $half : $lineCount - 1;
}
return $this->renderFile($this->callStackItemView, [
'file' => $file,
'line' => $line,
'class' => $class,
'method' => $method,
'index' => $index,
'lines' => $lines,
'begin' => $begin,
'end' => $end,
'args' => $args,
]);
}
例外をレンダリングします。
protected void renderException ( $exception ) | ||
$exception | Throwable |
レンダリングされる例外。 |
protected function renderException($exception)
{
if (Yii::$app->has('response')) {
$response = Yii::$app->getResponse();
// reset parameters of response to avoid interference with partially created response data
// in case the error occurred while sending the response.
$response->isSent = false;
$response->stream = null;
$response->data = null;
$response->content = null;
} else {
$response = new Response();
}
$response->setStatusCodeByException($exception);
$useErrorView = $response->format === Response::FORMAT_HTML && (!YII_DEBUG || $exception instanceof UserException);
if ($useErrorView && $this->errorAction !== null) {
Yii::$app->view->clear();
$result = Yii::$app->runAction($this->errorAction);
if ($result instanceof Response) {
$response = $result;
} else {
$response->data = $result;
}
} elseif ($response->format === Response::FORMAT_HTML) {
if ($this->shouldRenderSimpleHtml()) {
// AJAX request
$response->data = '<pre>' . $this->htmlEncode(static::convertExceptionToString($exception)) . '</pre>';
} else {
// if there is an error during error rendering it's useful to
// display PHP error in debug mode instead of a blank screen
if (YII_DEBUG) {
ini_set('display_errors', 1);
}
$file = $useErrorView ? $this->errorView : $this->exceptionView;
$response->data = $this->renderFile($file, [
'exception' => $exception,
]);
}
} elseif ($response->format === Response::FORMAT_RAW) {
$response->data = static::convertExceptionToString($exception);
} else {
$response->data = $this->convertExceptionToArray($exception);
}
$response->send();
}
ビューファイルをPHPスクリプトとしてレンダリングします。
public string renderFile ( $_file_, $_params_ ) | ||
$_file_ | string |
ビューファイル。 |
$_params_ | array |
ビューファイルで抽出され利用可能になるパラメータ(名前と値のペア)。 |
return | string |
レンダリング結果 |
---|
public function renderFile($_file_, $_params_)
{
$_params_['handler'] = $this;
if ($this->exception instanceof ErrorException || !Yii::$app->has('view')) {
ob_start();
ob_implicit_flush(false);
extract($_params_, EXTR_OVERWRITE);
require Yii::getAlias($_file_);
return ob_get_clean();
}
$view = Yii::$app->getView();
$view->clear();
return $view->renderFile($_file_, $_params_, $this);
}
指定されたExceptionの以前の例外スタックをレンダリングします。
public string renderPreviousExceptions ( $exception ) | ||
$exception | Throwable |
先行するものをレンダリングする必要がある例外。 |
return | string |
レンダリングされた以前の例外のHTMLコンテンツ。ない場合は空の文字列。 |
---|
public function renderPreviousExceptions($exception)
{
if (($previous = $exception->getPrevious()) !== null) {
return $this->renderFile($this->previousExceptionView, ['exception' => $previous]);
}
return '';
}
public string renderRequest ( ) | ||
return | string |
レンダリング結果 |
---|
public function renderRequest()
{
$request = '';
foreach ($this->displayVars as $name) {
if (!empty($GLOBALS[$name])) {
$request .= '$' . $name . ' = ' . VarDumper::export($GLOBALS[$name]) . ";\n\n";
}
}
return '<pre>' . $this->htmlEncode(rtrim($request, "\n")) . '</pre>';
}
protected boolean shouldRenderSimpleHtml ( ) | ||
return | boolean |
単純なHTMLをレンダリングする必要がある場合 |
---|
protected function shouldRenderSimpleHtml()
{
return YII_ENV_TEST || Yii::$app->request->getIsAjax();
}
定義元: yii\base\Component::trigger()
イベントをトリガーします。
このメソッドは、イベントの発生を表します。クラスレベルのハンドラを含む、イベントにアタッチされたすべてのハンドラを呼び出します。
public void trigger ( $name, yii\base\Event $event = null ) | ||
$name | string |
イベント名 |
$event | yii\base\Event|null |
イベントインスタンス。設定されていない場合、デフォルトのyii\base\Eventオブジェクトが作成されます。 |
public function trigger($name, Event $event = null)
{
$this->ensureBehaviors();
$eventHandlers = [];
foreach ($this->_eventWildcards as $wildcard => $handlers) {
if (StringHelper::matchWildcard($wildcard, $name)) {
$eventHandlers[] = $handlers;
}
}
if (!empty($this->_events[$name])) {
$eventHandlers[] = $this->_events[$name];
}
if (!empty($eventHandlers)) {
$eventHandlers = call_user_func_array('array_merge', $eventHandlers);
if ($event === null) {
$event = new Event();
}
if ($event->sender === null) {
$event->sender = $this;
}
$event->handled = false;
$event->name = $name;
foreach ($eventHandlers as $handler) {
$event->data = $handler[1];
call_user_func($handler[0], $event);
// stop further handling if the event is handled
if ($event->handled) {
return;
}
}
}
// invoke class-level attached handlers
Event::trigger($this, $name, $event);
}
定義元: yii\base\ErrorHandler::unregister()
PHPのエラーハンドラと例外ハンドラを復元することにより、このエラーハンドラを登録解除します。
public void unregister ( ) |
バージョン | 説明 |
---|---|
2.0.32 | エラーハンドラが登録されていない場合、これは何もしません |
public function unregister()
{
if ($this->_registered) {
$this->_memoryReserve = null;
$this->_workingDirectory = null;
restore_error_handler();
restore_exception_handler();
$this->_registered = false;
}
}
サインアップ または ログイン してコメントしてください。