PEAR is archived and read-only

This mirror preserves historical PEAR package releases and metadata so existing references remain available.

Home » Configuration » Config » Bug #4623

Apache container breaks on sections with arguments

Details

Submitted2005-06-18 04:15 UTC
Frommatt at conundrum dot com
Assignedaashley
StatusClosed
PackageConfig
PHP Version4.3.11
OSany
Roadmaps(Not assigned)

Comments

[2005-06-18 04:15 UTC] matt at conundrum dot com

Description:
------------
the Apache container is unable to handle standard apache sections which contain arguments, such as <Virtualhost foo.com> or <Directory /path>

for example, given the file "test_in.conf":
<VirtualHost 127.0.0.1>
ServerName www.foo.com
</VirtualHost>

<Directory /path/to/foo>
Limit GET
</Directory>

Reproduce code:
---------------
<?php
require_once('Config.php');
$conf = new Config;
$root =& $conf->parseConfig('./test_in.conf', 'Apache');
echo $root->toString('Apache' );
$conf->writeConfig('./test_out.conf', 'Apache' );
?>

Expected result:
----------------
<VirtualHost 127.0.0.1>
ServerName www.foo.com
</VirtualHost>

<Directory /path/to/foo>
Limit GET
</Directory>

test_out.conf should be identical to test_in.conf

Actual result:
--------------
<VirtualHost 127.0.0.1>
ServerName www.foo.com
</VirtualHost>

<Directory /path/to/foo>
Limit GET
</Directory>

test_out.conf is missing data:

<VirtualHost>
ServerName www.foo.com
</VirtualHost>

<Directory>
Limit GET
</Directory>

Given that the toString output is correct, but the data saved to test_out.conf is not, I suspect the problem is in writeConfig

[2005-12-19 08:03 UTC] aashley at php dot net

Problem is related to use of each in Config_Container_Apache::toString(). You would experience the same problem doing:

echo $root->toString('Apache' );
echo $root->toString('Apache' );

Replaced it with a foreach to fix problem.
http://www.adamashley.name/stuff/config-apache-container.patch

[2005-12-24 02:34 UTC] aashley at php dot net

This bug has been fixed in CVS.

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.