Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Space in network name causes config file to be mis-parsed #37

Open
progval opened this issue Oct 22, 2022 · 1 comment
Open

Space in network name causes config file to be mis-parsed #37

progval opened this issue Oct 22, 2022 · 1 comment
Assignees
Labels
bug Something isn't working

Comments

@progval
Copy link
Collaborator

progval commented Oct 22, 2022

This config file:

info {
    SID "00A";
    network-name "testnetwork";
    services-name "services.example.org";
}

link {
    hostname "0.0.0.0";
    port "50939";
    password "password";
}

sql {
    port "3306";
    user "pifpaf";
    password "pifpaf";
    sockfile "/tmp/tmp8jkbphz2/mysql.socket";
    prefix "dlk5bff38242512_";
}

wordpress {
    prefix "wp5bff38242512_";
}

is correctly rewritten as:

info::SID::00A
info::network-name::testnetwork
info::services-name::services.example.org
link::hostname::0.0.0.0
link::port::50939
link::password::password
sql::port::3306
sql::user::pifpaf
sql::password::pifpaf
sql::sockfile::/tmp/tmp8jkbphz2/mysql.socket
sql::prefix::dlk5bff38242512_
wordpress::prefix::wp5bff38242512_

which is then parsed as:

Array
(
    [info] => Array
        (
            [SID] => 00A
            [network-name] => testnetwork
            [services-name] => services.example.org
        )

    [link] => Array
        (
            [hostname] => 0.0.0.0
            [port] => 50939
            [password] => password
        )

    [sql] => Array
        (
            [port] => 3306
            [user] => pifpaf
            [password] => pifpaf
            [sockfile] => /tmp/tmp8jkbphz2/mysql.socket
            [prefix] => dlk5bff38242512_
        )

    [wordpress] => Array
        (
            [prefix] => wp5bff38242512_
        )

)

However, when replacing testnetwork with test network in the config file, it gets rewritten as:

info::SID::00A
info::network-name test network
services-name::services.example.org
link::hostname::0.0.0.0
link::port::38449
link::password::password
sql::port::3306
sql::user::pifpaf
sql::password::pifpaf
sql::sockfile::/tmp/tmpf2bqbfj1/mysql.socket
sql::prefix::dlk74b63dab1e07_
wordpress::prefix::wp74b63dab1e07_

which is then incorrectly parsed as:

Array
(
    [info] => Array
        (
            [SID] => 00A
            [0] => network-name test network
        )

    [services-name] => Array
        (
            [0] => services.example.org
        )

    [link] => Array
        (
            [hostname] => 0.0.0.0
            [port] => 38449
            [password] => password
        )

    [sql] => Array
        (
            [port] => 3306
            [user] => pifpaf
            [password] => pifpaf
            [sockfile] => /tmp/tmpf2bqbfj1/mysql.socket
            [prefix] => dlk74b63dab1e07_
        )

    [wordpress] => Array
        (
            [prefix] => wp74b63dab1e07_
        )

)

causing this error:

Configuration test failed. Dalek encountered the following error(s):
'info::network-name' not found.
'info::services-name' not found.
@progval progval added the bug Something isn't working label Oct 22, 2022
@ValwareIRC
Copy link
Member

I've started a fix with this on 92a8832
After I've changed things to use config_get_item() instead of global $cf array to check array items, this should fix the problem. Stay tuned

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Todo
Development

No branches or pull requests

2 participants