Req #67331 [Opn]: Have parse_ini_file add empty entries
| From: | philip@php.net | Date: | Fri, 23 May 2014 02:39:24 +0000 |
| Subject: | Req #67331 [Opn]: Have parse_ini_file add empty entries | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-185903@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=67331&edit=1
ID: 67331
Updated by: philip@php.net
Reported by: philip@php.net
Summary: Have parse_ini_file add empty entries
Status: Open
Type: Feature/Change Request
Package: *Configuration Issues
PHP Version: 5.6.0beta3
Block user comment: N
Private report: N
New Comment:
Johannes pointed out another example. Python allows the "No value" style, as documented
here:
https://docs.python.org/3/library/configparser.html#supported-ini-file-structure
Also, assigned value for these is worth discussing, as perhaps no value entries should be defined as
NULL instead of ""? In that case, the expected results would be:
array(3) {
["foo"]=>
string(3) "bar"
["auto-refresh"]=>
NULL
["baz"]=>
string(0) ""
}
Previous Comments:
------------------------------------------------------------------------
[2014-05-22 22:27:16] philip@php.net
Description:
------------
MySQL has options (such as "no-auto-rehash") in my.cnf that do not take values. In this
case, it's one of the following:
no-auto-rehash
auto-rehash
The parse_ini_* functions ignore these, as they lack an "=".
Test script:
---------------
philip$ php -r '$s = "foo = bar\nauto-rehash\nbaz =";
var_dump(parse_ini_string($s));'
Expected result:
----------------
array(3) {
["foo"]=>
string(3) "bar"
["auto-refresh"]=>
string(0) ""
["baz"]=>
string(0) ""
}
Actual result:
--------------
array(2) {
["foo"]=>
string(3) "bar"
["baz"]=>
string(0) ""
}
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=67331&edit=1