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

Bug #2179 parse_ini_file and tildes
Submitted: 2004-08-20 19:57 UTC
From: robert at osuosl dot org Assigned: ryansking
Status: Closed Package: Config
PHP Version: 5.0.0 OS: Linux (2.6.7)
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 : 27 - 19 = ?

 
 [2004-08-20 19:57 UTC] robert at osuosl dot org
Description: ------------ for URLs inside of an .ini file, the parse_ini_file will break when it encounters a tilde (~). Inside of IniFile.php, circa line 122, you have a bunch of conditions "or"ed together, looking for semicolons, commas, percents, etc. Tilde needs to be added to this list in order to allow URLs such as: http://www.example.com/~username/ After making the change, here's the diff: 123d122 < strpos($content, '~') !== false || Reproduce code: --------------- --config.conf.php-- [server] url="http://www.example.com/~username/path" <?php // config.php include("Config.php"); $c = new Config(); $configFile = "config.conf.php"; $root = $c->parseConfig($configFile, "IniFile"); $serverSection = $root->getItem("section", "server"); $server_uriDirective = $serverSection->getItem("directive", "uri"); $server_uriDirective->setContent($server_uriDirective->getContent() ); $res = $c->writeConfig(); /////// $root = $c->parseConfig($configFile, "IniFile"); ?> Expected result: ---------------- --config.conf.php-- [server] url="http://www.example.com/~username/path" Actual result: -------------- Warning: Error parsing config.conf.php on line 2 in /usr/share/php/Config/Container/IniFile.php on line 63 --resulting config.conf.php-- [server] uri=http://www.example.com/~username/path

Comments

 [2004-10-13 23:33 UTC] ryansking at mac dot com
I believe I have fixed this. I will relase an update later this evening.
 [2005-01-18 22:57 UTC] richtl at arscognita dot com
I'm having this problem with PHP v4.3.10 and Config 1.10.3. Tilde's in iniFile-formatted configuration files cause errors: Warning: Error parsing /home/richtl/workspace.tmp/mm_trunk/mindmeld.config on line 3 in /usr/share/pear/Config/Container/IniFile.php on line 63 Line 3 of mindmeld.config reads: site=/~richtl Did this bug ever really get fixed?