php8.5
Home/ Manual/ predefined / error/ Error::__clone

Error::__clone

PHP function Edit on GitHub ✎

(PHP 7, PHP 8)

Clone the error

Description

Error::__clone(): void

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

Warning

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

Parameters Parameters

Return Values

Void

Errors/Exceptions

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

Changelog

VersionDescription
8.1.0Error::__clone is no longer final.

Source: language/predefined/error/clone.xml · from the official PHP manual (php/doc-en)