mirror of
http://github.com/valkey-io/valkey
synced 2024-11-23 20:00:00 +00:00
Fix FUNCTION LOAD
ignores unknown parameter. (#10131)
Following discussion on: https://github.com/redis/redis/issues/9899#issuecomment-1014689385 Raise error if unknows parameter is given to `FUNCTION LOAD`. Before the fix: ``` 127.0.0.1:6379> function load LUA lib2 foo bar "local function test1() return 5 end redis.register_function('test1', test1)" OK ``` After the fix: ``` 127.0.0.1:6379> function load LUA lib2 foo bar "local function test1() return 5 end redis.register_function('test1', test1)" (error) ERR Unkowns option given: foo ```
This commit is contained in:
parent
ae89958972
commit
51f9bed3dd
@ -966,6 +966,8 @@ void functionLoadCommand(client *c) {
|
||||
desc = c->argv[argc_pos++]->ptr;
|
||||
continue;
|
||||
}
|
||||
addReplyErrorFormat(c, "Unknown option given: %s", (char*)next_arg->ptr);
|
||||
return;
|
||||
}
|
||||
|
||||
if (argc_pos >= c->argc) {
|
||||
|
@ -12,6 +12,13 @@ start_server {tags {"scripting"}} {
|
||||
r fcall test 0
|
||||
} {hello}
|
||||
|
||||
test {FUNCTION - Load with unknown argument} {
|
||||
catch {
|
||||
r function load LUA test foo bar [get_function_code test {return 'hello'}]
|
||||
} e
|
||||
set _ $e
|
||||
} {*Unknown option given*}
|
||||
|
||||
test {FUNCTION - Create an already exiting library raise error} {
|
||||
catch {
|
||||
r function load LUA test [get_function_code test {return 'hello1'}]
|
||||
|
Loading…
Reference in New Issue
Block a user