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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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: Thu Mar 28 14:01:29 2024 UTC