com php-src: Fixed #65213 - cannot cast SplFileInfo to boolean: NEWS ext/spl/spl_directory.c ext/spl/tests/bug65213 .phpt
| From: | Tjerk Anne Meesters | Date: | Wed, 03 Dec 2014 23:17:33 +0000 |
| Subject: | com php-src: Fixed #65213 - cannot cast SplFileInfo to boolean: NEWS ext/spl/spl_directory.c ext/spl/tests/bug65213 .phpt | ||
| Groups: | php.cvs | ||
| Request: | Send a blank email to php-cvs+get-83501@lists.php.net to get a copy of this message | ||
Commit: 2bcf8a6cd921486f0ee4835166984ecf4f0b2021
Author: Tjerk Meesters <datibbaw@php.net> Thu, 4 Dec 2014 07:17:33 +0800
Parents: 13aaba40cd1737157117591f5e28b5352ed1931d
Branches: PHP-5.5 PHP-5.6 master
Link: http://git.php.net/?p=php-src.git;a=commitdiff;h=2bcf8a6cd921486f0ee4835166984ecf4f0b2021
Log:
Fixed #65213 - cannot cast SplFileInfo to boolean
Bugs:
https://bugs.php.net/65213
Changed paths:
M NEWS
M ext/spl/spl_directory.c
A ext/spl/tests/bug65213.phpt
Diff:
diff --git a/NEWS b/NEWS
index 1154843..65df546 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 124a665..9f4e43f 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 0000000..5e34d95
--- /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===