Skip to content

Commit 3f2d5c6

Browse files
committed
Merge branch 'PHP-7.2' into PHP-7.3
2 parents 73ede69 + 1ac6b02 commit 3f2d5c6

File tree

3 files changed

+13
-3
lines changed

3 files changed

+13
-3
lines changed

ext/spl/spl_directory.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -379,8 +379,7 @@ static zend_object *spl_filesystem_object_clone(zval *zobject)
379379
intern->u.dir.index = index;
380380
break;
381381
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);
384383
}
385384

386385
intern->file_class = source->file_class;
@@ -3141,6 +3140,7 @@ PHP_MINIT_FUNCTION(spl_directory)
31413140
REGISTER_SPL_IMPLEMENTS(RecursiveDirectoryIterator, RecursiveIterator);
31423141

31433142
memcpy(&spl_filesystem_object_check_handlers, &spl_filesystem_object_handlers, sizeof(zend_object_handlers));
3143+
spl_filesystem_object_check_handlers.clone_obj = NULL;
31443144
spl_filesystem_object_check_handlers.get_method = spl_filesystem_object_get_method_check;
31453145

31463146
#ifdef HAVE_GLOB

ext/spl/tests/bug72884.phpt

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
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)

ext/spl/tests/bug72888.phpt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ try {
1212
var_dump($y);
1313
?>
1414
--EXPECTF--
15-
string(49) "An object of class SplFileObject cannot be cloned"
15+
string(60) "Trying to clone an uncloneable object of class SplFileObject"
1616

1717
Notice: Undefined variable: y in %sbug72888.php on line %d
1818
NULL

0 commit comments

Comments
 (0)