Unable to detect error from finfo constructor
| Bug #61173 | Unable to detect error from finfo constructor | ||||
|---|---|---|---|---|---|
| Submitted: | 2012-02-23 20:45 UTC | Modified: | 2012-03-07 07:45 UTC | ||
| From: | vrana@php.net | Assigned: | cataphract (profile) | ||
| Status: | Closed | Package: | Filesystem function related | ||
| PHP Version: | 5.4.0RC8 | OS: | Irrelevant | ||
| Private report: | No | CVE-ID: | None | ||
[2012-02-23 20:45 UTC] vrana@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) {
}
Patches
Pull Requests
History
AllCommentsChangesGit/SVN commits
[2012-02-24 08:34 UTC] cataphract@php.net
[2012-02-24 10:01 UTC] cataphract@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: cataphract
[2012-02-24 10:37 UTC] pajoye@php.net
[2012-02-24 10:37 UTC] pajoye@php.net
-Status: Closed +Status: Assigned
[2012-03-07 07:45 UTC] stas@php.net
-Status: Assigned +Status: Closed