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 07:41 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  
Comments Add Comment Add patch


Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know! Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem : 26 + 35 = ?

 
 [2005-10-04 07: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-24 02: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.