ZF2-8: Add option to support INI_SCANNER_RAW on Zend_Config_Ini to return proper type values

Description

if ($this->_rawMode) $iniArray = parse_ini_file($filename, true, INI_SCANNER_RAW); // Warnings and errors are suppressed else $iniArray = parse_ini_file($filename, true);

This breaks constants in the ini config though like APPLICATION_PATH never gets parsed :( I have to use a seperate config for the things i needed left untouched. Returning proper types like numbers and boolean values is really important.

Comments

Please see here, I wouldn't bother until the PHP guys has actually fixed this function. I've extended the ini config for now to Zend_Config_RawIni

http://bugs.php.net/bug.php?id=54057&edit=2

I guess providing a PHP based parsing system would be too slow ? Why is it that php is so buggy still, java has a property file system and works out of the box and provides correct types :(

true should not be wrapped in quotes and become a string, and a number should stay a number :)

INI_SCANNER_RAW requires PHP 5.3, so this can only be considered for ZF2.

It appears that INI_SCANNER_RAW is also buggy. See http://symfony.com/blog/symfony-2-0-3-released:

"The parse_ini_file() PHP function is buggy when used with the INI_SCANNER_RAW mode (it is unable to parse a configuration like foo="foo;foo", which occurs if you want tostore a DSN for instance: profiler_dsn="mysql:host=localhost;dbname=foobar")."

Waiting on ZF2 ;) My work around so far is to do string replacements to make them a proper boolean json value from a string value, but this is slowing this down a little. is there another work around ?

Ben: Any thoughts for ZF2?

We are not going to implement the "raw" option in ZF2 due to the buggy behaviour mentioned by Rob. Without knowing the use case for it, we are going to close this issue.