phpday 2027 - Call for Papers

Exception::__clone

(PHP 5, PHP 7, PHP 8)

Exception::__clone — Clone the exception

Опис

private function Exception::__clone(): void

Exceptions do not support cloning; this method exists only to prevent it.

Увага

Exceptions cannot be cloned, whether they are instances of Exception or of a subclass. Attempting to clone an exception throws an Error, which may be caught.

Параметри

У цієї функції немає параметрів.

Значення, що повертаються

Не повертає значень.

Помилки/виключення

Attempting to clone an exception throws an Error with the following message: Trying to clone an uncloneable object of class ClassName.

Журнал змін

Версія Опис
8.1.0 Exception::__clone() is no longer declared final, because declaring a private method final emits a warning as of PHP 8.0.0. Exceptions remain uncloneable.

User Contributed Notes

There are no user contributed notes for this page.
Adding new notes is disabled. Please see the links in the Found A Problem? section.
To Top