From: Xinchen Hui Date: Fri, 19 Aug 2016 03:28:36 +0000 (+0800) Subject: Fixed bug #72888 (Segfault on clone on splFileObject) X-Git-Tag: php-7.1.0beta3~1 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=566d65d222c00210aa67d6b937021c8100f54678;p=php Fixed bug #72888 (Segfault on clone on splFileObject) --- diff --git a/NEWS b/NEWS index 5e765fe81e..79e9398b76 100644 --- a/NEWS +++ b/NEWS @@ -62,6 +62,9 @@ PHP NEWS . Implemented RFC: Session ID without hashing. (Yasuo) https://wiki.php.net/rfc/session-id-without-hashing +- SPL: + . Fixed bug #72888 (Segfault on clone on splFileObject). (Laruence) + - SQLite3: . Updated to SQLite3 3.14.0. (cmb) diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 6c91c2e75d..67bfda8a3b 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -356,7 +356,7 @@ static zend_object *spl_filesystem_object_clone(zval *zobject) break; case SPL_FS_FILE: zend_throw_error(NULL, "An object of class %s cannot be cloned", ZSTR_VAL(old_object->ce->name)); - return NULL; + return new_object; } intern->file_class = source->file_class; diff --git a/ext/spl/tests/bug72888.phpt b/ext/spl/tests/bug72888.phpt new file mode 100644 index 0000000000..7d2fc6db08 --- /dev/null +++ b/ext/spl/tests/bug72888.phpt @@ -0,0 +1,18 @@ +--TEST-- +Bug #72888 (Segfault on clone on splFileObject) +--FILE-- +getMessage()); +} +var_dump($y); +?> +--EXPECTF-- +string(49) "An object of class SplFileObject cannot be cloned" + +Notice: Undefined variable: y in %sbug72888.php on line %d +NULL