Edit report at https://bugs.php.net/bug.php?id=65213&edit=1
ID: 65213 Updated by: larue...@php.net Reported by: fake at example dot com Summary: cannot cast SplFileInfo to boolean Status: Open -Type: Bug +Type: Feature/Change Request Package: SPL related PHP Version: 5.5.0 Block user comment: N Private report: N New Comment: change to FR Previous Comments: ------------------------------------------------------------------------ [2013-07-06 14:23:15] fake at example dot com Description: ------------ Casting an instance of SplFileInfo to boolean throws an exception. It should behave like other objects, where the cast always results in boolean true without throwing. Otherwise, it breaks common code like if (!$myObj) {...} Test script: --------------- <?php $o = new SplFileInfo('.'); var_dump((bool) $o); Expected result: ---------------- I expect (bool) true as output. Actual result: -------------- Catchable fatal error: Object of class SplFileInfo could not be converted to boolean in ... ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=65213&edit=1