File tree Expand file tree Collapse file tree 4 files changed +17
-3
lines changed Expand file tree Collapse file tree 4 files changed +17
-3
lines changed Original file line number Diff line number Diff line change @@ -25,6 +25,10 @@ PHP NEWS
25
25
. Fixed bug #78510 (Partially uninitialized buffer returned by
26
26
sodium_crypto_generichash_init()). (Frank Denis, cmb)
27
27
28
+ - SPL:
29
+ . Fixed bug #72884 (SplObject isCloneable() returns true but errs on clone).
30
+ (Chu Zhaowei)
31
+
28
32
29 Aug 2019, PHP 7.2.22
29
33
30
34
- Core:
Original file line number Diff line number Diff line change @@ -379,8 +379,7 @@ static zend_object *spl_filesystem_object_clone(zval *zobject)
379
379
intern -> u .dir .index = index ;
380
380
break ;
381
381
case SPL_FS_FILE :
382
- zend_throw_error (NULL , "An object of class %s cannot be cloned" , ZSTR_VAL (old_object -> ce -> name ));
383
- return new_object ;
382
+ ZEND_ASSERT (0 );
384
383
}
385
384
386
385
intern -> file_class = source -> file_class ;
@@ -3168,6 +3167,7 @@ PHP_MINIT_FUNCTION(spl_directory)
3168
3167
REGISTER_SPL_IMPLEMENTS (RecursiveDirectoryIterator , RecursiveIterator );
3169
3168
3170
3169
memcpy (& spl_filesystem_object_check_handlers , & spl_filesystem_object_handlers , sizeof (zend_object_handlers ));
3170
+ spl_filesystem_object_check_handlers .clone_obj = NULL ;
3171
3171
spl_filesystem_object_check_handlers .get_method = spl_filesystem_object_get_method_check ;
3172
3172
3173
3173
#ifdef HAVE_GLOB
Original file line number Diff line number Diff line change
1
+ --TEST--
2
+ Bug #72884: isCloneable() on SplFileObject should return false
3
+ --FILE--
4
+ <?php
5
+ $ x =new SplFileObject (__FILE__ );
6
+ $ r =new ReflectionObject ($ x );
7
+ var_dump ($ r ->isCloneable ());
8
+
9
+ --EXPECT --
10
+ bool (false )
Original file line number Diff line number Diff line change 12
12
var_dump ($ y );
13
13
?>
14
14
--EXPECTF--
15
- string(49 ) "An object of class SplFileObject cannot be cloned "
15
+ string(60 ) "Trying to clone an uncloneable object of class SplFileObject"
16
16
17
17
Notice: Undefined variable: y in %sbug72888.php on line %d
18
18
NULL
You can’t perform that action at this time.
0 commit comments