Bug #79115 [Opn->Ver]: ReflectionClass::isCloneable call reflected class __destruct

From: Date: Tue, 14 Jan 2020 18:43:36 +0000
Subject: Bug #79115 [Opn->Ver]: ReflectionClass::isCloneable call reflected class __destruct
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224899@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=79115&edit=1 ID: 79115 Updated by: requinix@php.net Reported by: brucekwells at gmail dot com Summary: ReflectionClass::isCloneable call reflected class __destruct -Status: Open +Status: Verified Type: Bug Package: Reflection related Operating System: Windows 10 PHP Version: 7.3.13 Block user comment: N Private report: N New Comment: There's some awkwardness going on for detecting cloneability that currently results in having to create a new instance and check whether *it* can be cloned. There should be room for improvement here. Previous Comments: ------------------------------------------------------------------------ [2020-01-14 15:04:04] brucekwells at gmail dot com Description: ------------ --- From manual page: https://php.net/reflectionclass.iscloneable --- When ReflectionClass::isCloneable is called, it calls the reflected class's destructor. Output should be nothing, but returns "__destruct". Uncomment __clone, and nothing is output, which is correct. See code snippet below. Test script: --------------- class A { function __construct() { echo __FUNCTION__ . "\n"; } function __destruct() { echo __FUNCTION__ . "\n"; } // function __clone() { echo __FUNCTION__ . "\n"; } } $c = new ReflectionClass('A'); $c->isCloneable(); Expected result: ---------------- No output should be returned. Actual result: -------------- __destruct ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=79115&edit=1

« previous php.bugs (#224899) next »