summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNikita Popov <nikita.ppv@gmail.com>2019-09-09 17:29:49 +0200
committerNikita Popov <nikita.ppv@gmail.com>2019-09-09 17:29:49 +0200
commit51fd8bd3eed46c7908937162eb8f245eeb9c6071 (patch)
tree8e531f4414ecf2bdacedb3e7d53883cd256c035b
parent3e89e9a636bffb642190a823f023da8e9aeaeaa4 (diff)
parent3f2d5c612e11f519f48b0f624190978dd1b5fc8b (diff)
downloadphp-git-51fd8bd3eed46c7908937162eb8f245eeb9c6071.tar.gz
Merge branch 'PHP-7.3' into PHP-7.4
-rw-r--r--ext/spl/spl_directory.c4
-rw-r--r--ext/spl/tests/bug72884.phpt10
-rw-r--r--ext/spl/tests/bug72888.phpt2
3 files changed, 13 insertions, 3 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index 9f70a2c867..691ae9b8d0 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -379,8 +379,7 @@ static zend_object *spl_filesystem_object_clone(zval *zobject)
intern->u.dir.index = index;
break;
case SPL_FS_FILE:
- zend_throw_error(NULL, "An object of class %s cannot be cloned", ZSTR_VAL(old_object->ce->name));
- return new_object;
+ ZEND_ASSERT(0);
}
intern->file_class = source->file_class;
@@ -3175,6 +3174,7 @@ PHP_MINIT_FUNCTION(spl_directory)
REGISTER_SPL_IMPLEMENTS(RecursiveDirectoryIterator, RecursiveIterator);
memcpy(&spl_filesystem_object_check_handlers, &spl_filesystem_object_handlers, sizeof(zend_object_handlers));
+ spl_filesystem_object_check_handlers.clone_obj = NULL;
spl_filesystem_object_check_handlers.get_method = spl_filesystem_object_get_method_check;
#ifdef HAVE_GLOB
diff --git a/ext/spl/tests/bug72884.phpt b/ext/spl/tests/bug72884.phpt
new file mode 100644
index 0000000000..178e0e1d70
--- /dev/null
+++ b/ext/spl/tests/bug72884.phpt
@@ -0,0 +1,10 @@
+--TEST--
+Bug #72884: isCloneable() on SplFileObject should return false
+--FILE--
+<?php
+$x=new SplFileObject(__FILE__);
+$r=new ReflectionObject($x);
+var_dump($r->isCloneable());
+
+--EXPECT--
+bool(false)
diff --git a/ext/spl/tests/bug72888.phpt b/ext/spl/tests/bug72888.phpt
index 7d2fc6db08..d354490f88 100644
--- a/ext/spl/tests/bug72888.phpt
+++ b/ext/spl/tests/bug72888.phpt
@@ -12,7 +12,7 @@ try {
var_dump($y);
?>
--EXPECTF--
-string(49) "An object of class SplFileObject cannot be cloned"
+string(60) "Trying to clone an uncloneable object of class SplFileObject"
Notice: Undefined variable: y in %sbug72888.php on line %d
NULL