Edit report at https://bugs.php.net/bug.php?id=61173&edit=1

 ID:                 61173
 Updated by:         paj...@php.net
 Reported by:        vr...@php.net
 Summary:            Unable to detect error from finfo constructor
-Status:             Closed
+Status:             Assigned
 Type:               Bug
 Package:            Filesystem function related
 Operating System:   Irrelevant
 PHP Version:        5.4.0RC8
 Assigned To:        cataphract
 Block user comment: N
 Private report:     N

 New Comment:

Please do not close bug when the fix has not been applied to 5.4, so we have a 
way 
to do not forget it as soon as 5.4-final is out.

Cheers,


Previous Comments:
------------------------------------------------------------------------
[2012-02-24 10:01:50] cataphr...@php.net

I've fixed it with the documented behavior.

------------------------------------------------------------------------
[2012-02-24 10:01:34] cataphr...@php.net

Automatic comment from SVN on behalf of cataphract
Revision: http://svn.php.net/viewvc/?view=revision&revision=323472
Log: - Fixed bug #61173 (Unable to detect error from finfo constructor).
- Tidied up NEWS

------------------------------------------------------------------------
[2012-02-24 08:34:49] cataphr...@php.net

The manual suggests new should give NULL in case of error: 
http://php.net/finfo_open . Why do you expect the exception? In any case, 
there's of course a bug because new is giving an object.

------------------------------------------------------------------------
[2012-02-23 20:45:57] vr...@php.net

Description:
------------
There is currently no way to detect error in finfo::__construct() other than 
defining own set_error_handler(). It should throw an exception in case of an 
error.

new finfo() always creates the object but this object is unusable if 
constructor doesn't succeed.

Test script:
---------------
$finfo = null;
try {
        $finfo = new finfo(1, '', false);
} catch (Exception $e) {
        echo "Error creating finfo.\n";
}
var_dump($finfo);


Expected result:
----------------
Error creating finfo.
NULL


Actual result:
--------------
object(finfo)#1 (0) {
}



------------------------------------------------------------------------



-- 
Edit this bug report at https://bugs.php.net/bug.php?id=61173&edit=1

Reply via email to