php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #73952 Reflection say interfaces are not cloneable
Submitted: 2017-01-17 06:41 UTC Modified: 2017-01-17 07:00 UTC
From: hidingitfrombots at example dot org Assigned:
Status: Not a bug Package: Reflection related
PHP Version: Irrelevant OS:
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: hidingitfrombots at example dot org
New email:
PHP Version: OS:

 

 [2017-01-17 06:41 UTC] hidingitfrombots at example dot org
Description:
------------
$interfaceReflection->isCloneable() always returns false for interfaces.

But they are, as all types are cloneable by default unless one explicitly makes __clone non public.

Additionally, it returns false even if __clone is explicitly defined:

interface Baz{ function __clone(); }
$rc = new ReflectionClass(Baz::class);
var_dump($rc->isCloneable()); // false

thanks


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-01-17 07:00 UTC] requinix@php.net
-Status: Open +Status: Not a bug
 [2017-01-17 07:00 UTC] requinix@php.net
Interfaces cannot be constructed, therefore they cannot be cloned. Same goes for traits and abstract classes. The existence and visibility of __clone only matters for regular classes.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Apr 20 08:01:30 2024 UTC