|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #66114 Request to add save_ini_file()
Submitted: 2013-11-18 20:09 UTC Modified: 2019-08-20 20:16 UTC
From: garet at approachfoundation dot org Assigned:
Status: Suspended Package: Filesystem function related
PHP Version: 5.5.6 OS: Any (FreeBSD)
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: garet at approachfoundation dot org
New email:
PHP Version: OS:


 [2013-11-18 20:09 UTC] garet at approachfoundation dot org
From manual page:

Though this is a simple request, I think being able to load and save ini files of this format will increase application portability in the long run for many people. If there were also a way to somewhat augment the parsing schema, to catch other common *nix .conf files, t'would be pretty nice.

Test script:

//Load my own configuration file for the user running this app
$ThisAppnConfig = parse_ini_file('~/.MyApplication');

//Load the global configuration for some package used in this app
$SomeAppConfig = parse_ini_file('/etc/SomeApp/default.conf');


//Update the user's settings to be compatible with my app

//Save the old value in case the user needs it


Expected result:
After loading and parsing two, standard configuration document, the developer uses values and may or may not transfer them to/from other config files with the same format.

At the end, a configuration file is generated from the associative array supplied. 

The only caveat is that on saving, a diff tool should be employed to align any pre-existing key/values to their same line number. By only appending new data to the end, we preserve any user-provided comments as well.

Would also be nice to have similar nesting detection both ways. I,e providing the following..

    [first_section] => Array
            [one] => 1
            [five] => 5
            [animal] => Dodo bird

    [second_section] => Array
            [path] => /usr/local/bin
            [URL] =>

Works as expected to append/replace within a section before falling back to file append.

Actual result:
None, feature request.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2018-02-28 22:17 UTC]
-Package: Unknown/Other Function +Package: Filesystem function related
 [2019-08-20 20:16 UTC]
-Status: Open +Status: Suspended
 [2019-08-20 20:16 UTC]
This feature (request) requires the RFC process[1].  Feel free to
start it anytime!

[1] <>
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Tue Jul 16 07:01:31 2024 UTC