Bug #79115 [Csd]: ReflectionClass::isCloneable calls reflected class __destruct

From: Date: Fri, 17 Jan 2020 13:29:20 +0000
Subject: Bug #79115 [Csd]: ReflectionClass::isCloneable calls reflected class __destruct
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-224964@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 User updated by: brucekwells at gmail dot com Reported by: brucekwells at gmail dot com -Summary: ReflectionClass::isCloneable call reflected class __destruct +Summary: ReflectionClass::isCloneable calls reflected class __destruct Status: Closed Type: Bug Package: Reflection related Operating System: Windows 10 PHP Version: 7.3.13 Block user comment: N Private report: N New Comment: Better title. Thanks for the fast fix! Previous Comments: ------------------------------------------------------------------------ [2020-01-17 10:38:37] nikic@php.net Automatic comment on behalf of nikita.ppv@gmail.com Revision: http://git.php.net/?p=php-src.git;a=commit;h=07bda97e765407bac9c37c9d4feb6aebb23434bd Log: Fixed bug #79115 ------------------------------------------------------------------------ [2020-01-14 18:43:36] requinix@php.net 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. ------------------------------------------------------------------------ [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 (#224964) next »