ZF-3196: E_WARNING is thrown (and no exception) when parse_ini_file fails in Zend_Config_Ini
Description
When there is a problem parsing the ini file passed to Zend_Config_Ini constructor, the PHP warning message is not caught and no exception is thrown. This is problematic because the developer has no way of knowing that a problem has happened - plus the E_WARNING message should not be displayed.
Use the following ini file to reproduce:
[default]
foo = ("bar")
Then, try to load this file with Zend_Config_Ini
Expected result: An exception thrown
Comments
Posted by julien PAULI (doctorrock83) on 2008-05-05T10:34:43.000+0000
I cannot reproduce your use-cased bug with PHP 5.2.5 and ZF at r9372
However, there is a PHP warning if the file loaded cannot be found or is not readable You can find more info in #ZF-2207
Posted by Rob Allen (rob) on 2008-06-08T08:06:23.000+0000
For PHP 5.2.0 or higher we can use error_get_last() to find the warning. e.g:
As we need to support PHP 5.1.4, we have to use a custom error handler:
Posted by Rob Allen (rob) on 2008-06-08T08:06:58.000+0000
Fixed on trunk in svn r9636.
Note that this introduces a small BC break if anyone was using the code with display_errors off, as now an exception will happen if this error occurs. Fixed only on trunk as a result.
Posted by julien PAULI (doctorrock83) on 2008-06-08T08:51:26.000+0000
You could use the track_errors cheat as well :
Posted by Wil Sinclair (wil) on 2008-09-02T10:39:44.000+0000
Updating for the 1.6.0 release.