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

ID: 12387
Updated by: cweiske@php.net
Reported By: pear at j9ac9k dot info
Summary: GenericConf doesn't allow for hyphens on
left-hand-side of a directive
Status: Open
Type: Bug
Package: Config
Operating System: irrelavent
Package Version: 1.10.11
PHP Version: 4.4.7
Roadmap Versions:
New Comment:

I think the expected output is "key-word:value"


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

[2007-11-05 23:53:08] paleozogt

Description:
------------
The GenericConf format doesn't allow hyphens on the LHS of a directive.
For example, this is valid:
key_word:value
but this is not
key-word:value

The underscore is allowed because the regexp used is "\w", which
includes alphanumeric and underscores. To support hyphen, a hyphen must
be explicitly included in the regexp.


Test script:
---------------
function demobug() {
// this will fail unless you remove the hyphen
$configtext= "key-word:value";

$testfile="/tmp/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:
----------------
it should display, "keyword:value"

Actual result:
--------------
it displays, "[pear_error: message="Syntax error in
'/tmp/testconfig.conf' at line 1." code=0 mode=return level=notice
prefix="" info=""]"

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

Search Discussions

  • Cweiske at Dec 20, 2010 at 8:49 pm
    Edit report at http://pear.php.net/bugs/bug.php?id=12387&edit=1

    ID: 12387
    Updated by: cweiske@php.net
    Reported By: pear at j9ac9k dot info
    Summary: GenericConf doesn't allow for hyphens on
    left-hand-side of a directive
    -Status: Open
    +Status: Closed
    Type: Bug
    Package: Config
    Operating System: irrelavent
    Package Version: 1.10.11
    PHP Version: 4.4.7
    -Assigned To:
    +Assigned To: cweiske
    Roadmap Versions:
    New Comment:

    -Status: Open
    +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:
    ------------------------------------------------------------------------

    [2010-12-20 21:42:35] cweiske

    I think the expected output is "key-word:value"

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

    [2007-11-05 23:53:08] paleozogt

    Description:
    ------------
    The GenericConf format doesn't allow hyphens on the LHS of a directive.
    For example, this is valid:
    key_word:value
    but this is not
    key-word:value

    The underscore is allowed because the regexp used is "\w", which
    includes alphanumeric and underscores. To support hyphen, a hyphen must
    be explicitly included in the regexp.


    Test script:
    ---------------
    function demobug() {
    // this will fail unless you remove the hyphen
    $configtext= "key-word:value";

    $testfile="/tmp/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:
    ----------------
    it should display, "keyword:value"

    Actual result:
    --------------
    it displays, "[pear_error: message="Syntax error in
    '/tmp/testconfig.conf' at line 1." code=0 mode=return level=notice
    prefix="" info=""]"

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

Related Discussions

Discussion Navigation
viewthread | post
Discussion Overview
grouppear-bugs @
categoriesphp
postedDec 20, '10 at 8:41p
activeDec 20, '10 at 8:49p
posts2
users1
websitepear.php.net

1 user in discussion

Cweiske: 2 posts

People

Translate

site design / logo © 2022 Grokbase