Skip to content

Commit 8a9a4ee

Browse files
marinaglancyandrewnicols
authored andcommitted
MDL-70131 cli: only allow to negate existing keys
1 parent 6d138e3 commit 8a9a4ee

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

lib/clilib.php

+2-1
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,8 @@ function cli_get_params(array $longoptions, array $shortmapping=null) {
106106
$key = reset($parts);
107107
$value = true;
108108

109-
if (substr($key, 0, 3) === 'no-') {
109+
if (substr($key, 0, 3) === 'no-' && !array_key_exists($key, $longoptions)
110+
&& array_key_exists(substr($key, 3), $longoptions)) {
110111
// Support flipping the boolean value.
111112
$value = !$value;
112113
$key = substr($key, 3);

0 commit comments

Comments
 (0)