Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 1.10.12

Bug #3137 saving in phparray after adding a comment
Submitted: 2005-01-08 15:04 UTC
From: bersace Assigned: aashley
Status: Closed Package: Config
PHP Version: 4.3.10 OS: Linux 2.6.9-1-686 GNU/Linux
Roadmaps: (Not assigned)    

 [2005-01-08 15:04 UTC] bersace
Description: ------------ With a simple array, parse it, add a comment at the top, then, when writing in phparray synthax, the first element of the array become an array with a single element. its key is 0 and his value is the old value of the first element of the primary array. This do not append with multidimensional array, or without comment. Reproduce code: --------------- <pre><?php require "Config.php"; $array = array("foo", "bar"); // the source of the config to write. $config = new Config(); $container =&$config->getRoot(); $container->createComment("Comment", "top"); // create a top comment // first dump, all is ok. echo $container->toString("phparray"); echo "<hr/>"; $config->parseConfig($array, "phparray"); // once again, it look a bit strange ! echo $container->toString("phparray"); ?> </pre> Expected result: ---------------- an expected result is that the dump is conform to the source array. // Comment $conf['0'] = 'foo'; $conf['1'] = 'bar'; Actual result: -------------- // Comment $conf['0'][0] = 'foo'; $conf['1'] = 'bar';


 [2005-01-08 17:03 UTC] bersace
I have this problem also with multidimensionnal Array. Sorry
 [2005-01-08 19:20 UTC] bersace
It's mean that I have this only with numbered Array, note with pure string keys.
 [2005-01-10 05:19 UTC] ryansking at mac dot com
I don't understand why you're trying to modify a configuration before reading it?
 [2005-08-30 15:58 UTC] spam_mesg at microdrive dot com
What are the rules for comments? I'm using the inifile format. I've tried // and # and both don't result in Config ignoring the line. I'm simply trying to 'comment out' a config line. If I remove the '=' then # appears to work.
 [2005-12-19 23:54 UTC] aashley at php dot net
problem due to 0 == '' in PHP. so countChildren() by name was considering index 0 to have the same name as an unnamed element (ie a comment).
 [2005-12-24 02:28 UTC] aashley at php dot net
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on by the end of next Sunday (CET). If this was a problem with the website, the change should be live shortly. Otherwise, the fix will appear in the package's next release. Thank you for the report and for helping us make PEAR better.