Bug #72884 [Opn]: SplObject isCloneable() returns true but errs on clone

From: Date: Fri, 19 Aug 2016 03:14:57 +0000
Subject: Bug #72884 [Opn]: SplObject isCloneable() returns true but errs on clone
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-203387@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=72884&edit=1 ID: 72884 Updated by: laruence@php.net Reported by: php at abiusx dot com Summary: SplObject isCloneable() returns true but errs on clone Status: Open Type: Bug Package: SPL related Operating System: OS X 10.11 PHP Version: 7.0.9 Block user comment: N Private report: N New Comment: hmm, the codes lead to segfault in 7.1 Previous Comments: ------------------------------------------------------------------------ [2016-08-18 16:34:25] php at abiusx dot com 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 this bug report at https://bugs.php.net/bug.php?id=72884&edit=1

« previous php.bugs (#203387) next »