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

Bug #5598 '=' in value breaks ini file
Submitted: 2005-10-04 02:41 UTC Modified: 2006-12-16 07:55 UTC
From: stefano dot s at webindustry dot it Assigned: aashley
Status: Closed Package: Config
PHP Version: 4.2.2 OS: Linux
Roadmaps: (Not assigned)    
Subscription  


 [2005-10-04 02:41 UTC] stefano dot s at webindustry dot it
Description: ------------ When a value contains a '=' char trying to save as ini file results in a broken file. example: key: url value: myurl.com/?section=test is saved as url=myurl.com/?section=test istead of url="myurl.com/?section=test" Test script: --------------- $conf = array('TEST' => array('one' => 'test1', 'two' => 'test2=test', 'three' => 'test3')); $config = new Config(); $config->parseConfig($conf, 'phparray', array('name' => 'conf')); $config->writeConfig("test.ini", 'inifile'); /*** PATCH ***/ in Config/Container/IniFile.php function tostring(), change the condition: } elseif (strlen(trim($content)) < strlen($content) || strpos($content, ',') !== false || strpos($content, ';') !== false || strpos($content, '"') !== false || strpos($content, '%') !== false) { $content = '"'.addslashes($content).'"'; as follows: } elseif (strlen(trim($content)) < strlen($content) || strpos($content, '=') !== false || /* ADDED */ strpos($content, ',') !== false || strpos($content, ';') !== false || strpos($content, '"') !== false || strpos($content, '%') !== false) { $content = '"'.addslashes($content).'"'; Expected result: ---------------- test.ini: [TEST] one=test1 two="test2=test" three=test3 Actual result: -------------- test.ini: [TEST] one=test1 two=test2=test three=test3

Comments

 [2005-12-23 21:37 UTC] aashley at php dot net
This bug has been fixed in CVS. If this was a documentation problem, the fix will appear on pear.php.net by the end of next Sunday (CET). If this was a problem with the pear.php.net 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.