Bug #53967 [PATCH]: ReflectionClass::isCloneable reports false positives
| From: | trannguyenhoang8433@gmail.com | Date: | Sun, 04 Aug 2019 05:41:49 +0000 |
| Subject: | Bug #53967 [PATCH]: ReflectionClass::isCloneable reports false positives | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-222076@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=53967&edit=1
ID: 53967
Patch added by: trannguyenhoang8433@gmail.com
Reported by: whatthejeff at gmail dot com
Summary: ReflectionClass::isCloneable reports false positives
Status: Analyzed
Type: Bug
Package: Reflection related
PHP Version: trunk-SVN-2011-02-09 (snap)
Block user comment: N
Private report: N
New Comment:
The following pull request has been associated:
Patch Name: error message should matched path
On GitHub: https://github.com/php/pecl-database-pdo_informix/pull/1
Patch: https://github.com/php/pecl-database-pdo_informix/pull/1.patch
Previous Comments:
------------------------------------------------------------------------
[2019-08-04 05:40:28] trannguyenhoang8433 at gmail dot com
The following pull request has been associated:
Patch Name: protect master branches except for the pecl repos against force pushes
On GitHub: https://github.com/php/karma/pull/4
Patch: https://github.com/php/karma/pull/4.patch
------------------------------------------------------------------------
[2017-12-09 22:03:05] nikic@php.net
I don't think so. As was mentioned, some objects determine clonability dynamically. There is no
real way to determine if something is clonable short of doing it and seeing if it throws. This also
holds for userland objects, of course. isClonable() can tell you when something definitely cannot be
cloned, but it's just impossible to say if it will succeed once __clone() comes into the
picture.
What do you need it for anyway? As of PHP 7, just cloning the object and catching Errors should be a
fine way to determine clonability, as it doesn't throw a fatal anymore.
------------------------------------------------------------------------
[2017-12-07 13:00:21] sebastian@php.net
Is there any chance to fix ReflectionClass::isCloneable() to work correctly for all internal
classes?
------------------------------------------------------------------------
[2011-02-11 22:48:53] whatthejeff at gmail dot com
Yeah, I actually realized ReflectionClass::isCloneable wouldn't work for SplFileObject and
SplTempFileObject when I was looking at the implementation for
SplFileObject.
------------------------------------------------------------------------
[2011-02-11 22:43:57] felipe@php.net
SplFileObject and SplTempFileObject are exception because the way as it was coded, there is a logic
behinds it to decide if it is clonable or not...
------------------------------------------------------------------------
The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
https://bugs.php.net/bug.php?id=53967
--
Edit this bug report at https://bugs.php.net/bug.php?id=53967&edit=1