FAQ
Edit report at http://pear.php.net/bugs/bug.php?id=12291&edit=1

ID: 12291
Updated by: cweiske@php.net
Reported By: pear at j9ac9k dot info
Summary: PEAR GenericConf newline shouldn't need a space
-Status: Verified
+Status: Closed
Type: Bug
Package: Config
Package Version: 1.10.11
PHP Version: 4.4.7
-Assigned To:
+Assigned To: cweiske
Roadmap Versions:
New Comment:

-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.




Previous Comments:
------------------------------------------------------------------------

[2008-05-14 08:44:05] doconnor

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)

------------------------------------------------------------------------

[2008-05-14 08:43:45] doconnor

<?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";
}

------------------------------------------------------------------------

[2007-10-22 04:38:55] paleozogt

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=""]'

------------------------------------------------------------------------

Search Discussions

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 21, '10 at 8:43a
activeDec 21, '10 at 8:43a
posts1
users1
websitepear.php.net

1 user in discussion

Cweiske: 1 post

People

Translate

site design / logo © 2022 Grokbase