Space in network name causes config file to be mis-parsed
progval opened this issue · comments
Val Lorentz commented
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.
Valerie Liu commented
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