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

Bug #12291 PEAR GenericConf newline shouldn't need a space
Submitted: 2007-10-22 08:38 UTC
From: paleozogt Assigned: cweiske
Status: Closed Package: Config (version 1.10.11)
PHP Version: 4.4.7 OS:
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 : 30 - 13 = ?

 
 [2007-10-22 08:38 UTC] paleozogt (Aaron Simmons)
Description: ------------ Config's 'GenericConf' *requires* the newline delimiter to be prefixed by a space. There are many valid configuration files out there that do not use a space. For example, this file will be parse successfully (notice the space preceeding the '\'): 1 keyword:value1, \ 2 value2 while this one will not (notice there's no space preceeding the '\'): 1 keyword:value1,\ 2 value2 Test script: --------------- function demobug() { // if you add a space right before the \\ it will work // otherwise it will fail $configtext= "keyword:value1,\\\nvalue2"; $testfile="testconfig.conf"; $file = fopen ($testfile, "w"); fwrite($file, $configtext); fclose ($file); $c = new Config(); $conf=& $c->parseConfig($testfile, "GenericConf"); echo $conf->toString('GenericConf', $options); } Expected result: ---------------- Should print 'keyword:value1, value2' Actual result: -------------- Prints '[pear_error: message="Syntax error in 'testconfig.conf' at line 2." code=0 mode=return level=notice prefix="" info=""]'

Comments

 [2008-05-14 12:43 UTC] doconnor (Daniel O'Connor)
<?php require 'Config.php'; $configtext = array(); $configtext[] = "keyword:value1,\\\nvalue2"; $configtext[] = "keyword:value1, \\\nvalue2"; foreach ($configtext as $n => $data) { $path = dirname(__FILE__) . "bug-12291-" . $n . ".txt"; file_put_contents($path, $data); $c = new Config(); $conf=& $c->parseConfig($path, "GenericConf"); print "Result " . $n . "\n"; print $conf->toString('GenericConf', array()) . "\n"; }
 [2008-05-14 12:44 UTC] doconnor (Daniel O'Connor)
produces ---------- PHP ---------- Result 0 [pear_error: message="Syntax error in 'G:\workbug-12291-0.txt' at line 2." code=0 mode=return level=notice prefix="" info=""] Result 1 keyword:value1, value2 Output completed (0 sec consumed)
 [2010-12-21 14:18 UTC] cweiske (Christian Weiske)
-Status: Verified +Status: Closed -Assigned To: +Assigned To: cweiske
This bug has been fixed in SVN. 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.