Skip to content

Apache Directives without argument fail to parse #3

@rickschippers

Description

@rickschippers

I have a few vhosts that use the SSLRequireSSL directive (https://httpd.apache.org/docs/2.4/mod/mod_ssl.html#sslrequiressl).

This directive is used as is. There are no parameters, no on/off. It's just a line inside a vhosts that states: SSLRequireSSL. Nothing else.

When you have a config file that has this it fails to parse. You get "Apache config format error!".
This is caused by the regex in ConfigType/Apache.php which expects a whitespace and then some more things which isn't there.

            if (preg_match('/^\s*(\w+)(?:\s+(.*?)|)\s*$/', $configLine, $configMatches)) { // Property
                if (!isset($configMatches[2])) {
                    throw new \UnexpectedValueException("Apache config format error!");
                }
                if ($level === 0) {
                    $block[$configMatches[1]] = $configMatches[2];
                    $result = $this->append($block, $result);
                    $block = array();
                } else {
                    $blockIn[$configMatches[1]] = $configMatches[2];
                    $blockChild = $this->append($blockIn, $blockChild);
                    $blockIn = array();
                }
            }

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions