From: Tjerk Meesters Date: Wed, 3 Dec 2014 23:17:33 +0000 (+0800) Subject: Fixed #65213 - cannot cast SplFileInfo to boolean X-Git-Tag: PRE_NATIVE_TLS_MERGE~68^2^2 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=2bcf8a6cd921486f0ee4835166984ecf4f0b2021;p=php Fixed #65213 - cannot cast SplFileInfo to boolean --- diff --git a/NEWS b/NEWS index 115484323c..65df546662 100644 --- a/NEWS +++ b/NEWS @@ -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-- + +===DONE=== +--EXPECT-- +bool(true) +===DONE===