Skip to content

Commit 52b41f2

Browse files
committed
Merge branch 'PHP-5.5' into PHP-5.6
* PHP-5.5: Fixed #65213 - cannot cast SplFileInfo to boolean
2 parents 5deac25 + 2bcf8a6 commit 52b41f2

File tree

2 files changed

+16
-0
lines changed

2 files changed

+16
-0
lines changed

ext/spl/spl_directory.c

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1907,6 +1907,9 @@ static int spl_filesystem_object_cast(zval *readobj, zval *writeobj, int type TS
19071907
}
19081908
return SUCCESS;
19091909
}
1910+
} else if (type == IS_BOOL) {
1911+
ZVAL_BOOL(writeobj, 1);
1912+
return SUCCESS;
19101913
}
19111914
if (readobj == writeobj) {
19121915
zval_dtor(readobj);

ext/spl/tests/bug65213.phpt

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
--TEST--
2+
Bug #65213 (cannot cast SplFileInfo to boolean)
3+
--FILE--
4+
<?php
5+
6+
$o = new SplFileInfo('.');
7+
var_dump((bool) $o);
8+
9+
?>
10+
===DONE===
11+
--EXPECT--
12+
bool(true)
13+
===DONE===

0 commit comments

Comments
 (0)