Bug #72884 [NEW]: SplObject isCloneable() returns true but errs on clone
From: php at abiusx dot com
Operating system: OS X 10.11
PHP version: 7.0.9
Package: SPL related
Bug Type: Bug
Bug description:SplObject isCloneable() returns true but errs on clone
Description:
------------
An SplFileObject is clonable according to reflection, but errs on
attempting to clone.
Related bug report: 53967
Test script:
---------------
$x=new SplFileObject("tests.php");
$r=new ReflectionObject($x);
var_dump($r->isCloneable());
$y=clone $x; //fatal error
Expected result:
----------------
At worst, such things should issue a warning. This clone might happen as
part of more general clone that involves many objects and arrays, and
with a fatal error there is no way to recover from this, but it is not a
big deal and should be recoverable.
Changing it to E_WARNING is a possible scenario, or throwing appropriate
exceptions on PHP 7.
Also, note in the documentation that reflection stats are not accurate
regarding core classes and functions.
Actual result:
--------------
make cloneable, return false, or E_WARNING
--
Edit bug report at https://bugs.php.net/bug.php?id=72884&edit=1
--
Try a snapshot (PHP 5.4): https://bugs.php.net/fix.php?id=72884&r=trysnapshot54
Try a snapshot (PHP 5.5): https://bugs.php.net/fix.php?id=72884&r=trysnapshot55
Try a snapshot (trunk): https://bugs.php.net/fix.php?id=72884&r=trysnapshottrunk
Fixed in SVN: https://bugs.php.net/fix.php?id=72884&r=fixed
Fixed in release: https://bugs.php.net/fix.php?id=72884&r=alreadyfixed
Need backtrace: https://bugs.php.net/fix.php?id=72884&r=needtrace
Need Reproduce Script: https://bugs.php.net/fix.php?id=72884&r=needscript
Try newer version: https://bugs.php.net/fix.php?id=72884&r=oldversion
Not developer issue: https://bugs.php.net/fix.php?id=72884&r=support
Expected behavior: https://bugs.php.net/fix.php?id=72884&r=notwrong
Not enough info: https://bugs.php.net/fix.php?id=72884&r=notenoughinfo
Submitted twice: https://bugs.php.net/fix.php?id=72884&r=submittedtwice
register_globals: https://bugs.php.net/fix.php?id=72884&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=72884&r=php4
Daylight Savings: https://bugs.php.net/fix.php?id=72884&r=dst
IIS Stability: https://bugs.php.net/fix.php?id=72884&r=isapi
Install GNU Sed: https://bugs.php.net/fix.php?id=72884&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=72884&r=float
No Zend Extensions: https://bugs.php.net/fix.php?id=72884&r=nozend
MySQL Configuration Error: https://bugs.php.net/fix.php?id=72884&r=mysqlcfg
Thread (5 messages)
- php at abiusx dot com