|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #79115 ReflectionClass::isCloneable calls reflected class __destruct
Submitted: 2020-01-14 15:04 UTC Modified: 2020-01-17 13:29 UTC
Avg. Score:1.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: brucekwells at gmail dot com Assigned:
Status: Closed Package: Reflection related
PHP Version: 7.3.13 OS: Windows 10
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
Solve the problem:
49 + 34 = ?
Subscribe to this entry?

 [2020-01-14 15:04 UTC] brucekwells at gmail dot com
From manual page:

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');

Expected result:
No output should be returned.

Actual result:


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2020-01-14 18:43 UTC]
-Status: Open +Status: Verified
 [2020-01-14 18:43 UTC]
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-17 10:38 UTC]
Automatic comment on behalf of
Log: Fixed bug #79115
 [2020-01-17 10:38 UTC]
-Status: Verified +Status: Closed
 [2020-01-17 13:29 UTC] brucekwells at gmail dot com
-Summary: ReflectionClass::isCloneable call reflected class __destruct +Summary: ReflectionClass::isCloneable calls reflected class __destruct
 [2020-01-17 13:29 UTC] brucekwells at gmail dot com
Better title.  Thanks for the fast fix!
PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Thu Nov 30 01:01:28 2023 UTC