diff options
author | Tjerk Meesters <datibbaw@php.net> | 2014-12-04 07:17:33 +0800 |
---|---|---|
committer | Tjerk Meesters <datibbaw@php.net> | 2014-12-04 07:17:33 +0800 |
commit | 2bcf8a6cd921486f0ee4835166984ecf4f0b2021 (patch) | |
tree | adb79d2cccb324685240f0db2dcaa8b85347d439 | |
parent | 13aaba40cd1737157117591f5e28b5352ed1931d (diff) | |
download | php-git-2bcf8a6cd921486f0ee4835166984ecf4f0b2021.tar.gz |
Fixed #65213 - cannot cast SplFileInfo to boolean
-rw-r--r-- | NEWS | 1 | ||||
-rw-r--r-- | ext/spl/spl_directory.c | 3 | ||||
-rw-r--r-- | ext/spl/tests/bug65213.phpt | 13 |
3 files changed, 17 insertions, 0 deletions
@@ -25,6 +25,7 @@ PHP NEWS - SPL: . Fixed bug #66405 (RecursiveDirectoryIterator::CURRENT_AS_PATHNAME breaks the RecursiveIterator). (Paul Garvin) + . Fixed bug #65213 (cannot cast SplFileInfo to boolean) (Tjerk) 11 Dec 2014, PHP 5.5.20 diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 124a665991..9f4e43f727 100644 --- a/ext/spl/spl_directory.c +++ b/ext/spl/spl_directory.c @@ -1907,6 +1907,9 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type TS } return SUCCESS; } + } else if (type == IS_BOOL) { + ZVAL_BOOL(writeobj, 1); + return SUCCESS; } if (readobj == writeobj) { zval_dtor(readobj); diff --git a/ext/spl/tests/bug65213.phpt b/ext/spl/tests/bug65213.phpt new file mode 100644 index 0000000000..5e34d9549c --- /dev/null +++ b/ext/spl/tests/bug65213.phpt @@ -0,0 +1,13 @@ +--TEST-- +Bug #65213 (cannot cast SplFileInfo to boolean) +--FILE-- +<?php + +$o = new SplFileInfo('.'); +var_dump((bool) $o); + +?> +===DONE=== +--EXPECT-- +bool(true) +===DONE=== |