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

Issue Type: Improvement Created: 2011-02-20T17:07:43.000+0000 Last Updated: 2012-04-29T10:54:22.000+0000 Status: Resolved Fix version(s): Reporter: Dan Rossi (danielr) Assignee: Ben Scholzen (dasprid) Tags: - Zend\Config

Related issues: Attachments:


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.


Posted by Dan Rossi (danielr) on 2011-02-20T18:46:27.000+0000

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

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 :)

Posted by Rob Allen (rob) on 2011-05-23T12:52:49.000+0000

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

Posted by Rob Allen (rob) on 2011-09-25T10:20:25.000+0000

It appears that INI_SCANNER_RAW is also buggy. See

"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")."

Posted by Dan Rossi (danielr) on 2011-09-25T13:57:57.000+0000

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 ?

Posted by Rob Allen (rob) on 2012-04-28T16:20:48.000+0000

Ben: Any thoughts for ZF2?

Posted by Rob Allen (rob) on 2012-04-29T10:53:37.000+0000

PHP Bug is:

Posted by Ben Scholzen (dasprid) on 2012-04-29T10:54:22.000+0000

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.

Have you found an issue?

See the Overview section for more details.


© 2006-2018 by Zend, a Rogue Wave Company. Made with by awesome contributors.

This website is built using zend-expressive and it runs on PHP 7.