catalyst / moodle-tool_abconfig

A way to A/B test config, or slowly turn on config for certain audiences or % of traffic
https://moodle.org/plugins/tool_abconfig
6 stars 4 forks source link

EOL symbol "\r" breaks config settings #39

Closed golenkovm closed 2 years ago

golenkovm commented 2 years ago

Setting the following as experiment commands

CFG,debug,32767
CFG,debugdisplay,1

gives me ["CFG,debug,32767\r","CFG,debugdisplay,1"] stored in DB which leads to debug setting is rejected: Invalid current value: 32767.

It sems like a kind of cleanup is required before storing data in DB.

image

golenkovm commented 2 years ago

As I can see PHP_EOL is defined as "\n" while form passes CFG,debug,32767\r\nCFG,debugdisplay,1 as a value for the command. After exploding by PHP_EOL "\r" remains