diff options
| -rw-r--r-- | ext/spl/spl_directory.c | 3 | ||||
| -rw-r--r-- | ext/spl/tests/bug65213.phpt | 13 |
2 files changed, 16 insertions, 0 deletions
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c index 2875cc2e74..4437ca8749 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=== |
