[PATCH] Config doesn't parse ini files with directive names containing spaces
| From: | Jesper Veggerby Hansen | Date: | Fri, 08 Oct 2004 08:23:39 +0000 |
| Subject: | [PATCH] Config doesn't parse ini files with directive names containing spaces | ||
| Groups: | php.pear.dev | ||
| Request: | Send a blank email to pear-dev+get-33701@lists.php.net to get a copy of this message | ||
Hi Guys,
Had a problem with Config and it parsing inifiles from Samba (smb.conf) there are 2 problems that caused this problem. Samba uses the yes/no syntax for booleans, which means that using 'inifile' as container type converts all yes/no to 1/0 (or empty), this should be supported by Samba, although it does not appear so in my case. Therefor I tried using 'inicommented' instead, since it does not use parse_ini_file() (which is the one doing the subst.). However 'inicommented' does not support the use of spaces in the directive name, which Samba uses a lot (fx. 'netbios name', 'wins server', etc.). Therefor I changed:
preg_match('/^\s*([a-zA-Z0-9_\-\.]*)\s*=\s*(.*)\s*$/', ...
To:
preg_match('/^\s*([a-zA-Z0-9_\-\.\s]*)\s*=\s*(.*)\s*$/', ...
On line 72 in IniCommented.php and it works like a charm, the "patch" is here:
http://pear.veggerby.dk/patch/IniCommented.phps
Don't know if this was left out on purpose, but for my case it is required for passing the ini file, so I would definitely like to have it included.
Regards
Jesper Veggerby Hansen