Skip to content

Commit 83705be

Browse files
authored
Fix words variable environment leak (#73)
After tab-completing, the `$words` array would persist and possibly affect other things. Using `local` keeps it inside the function scope.
1 parent 5adeafb commit 83705be

File tree

4 files changed

+4
-4
lines changed

4 files changed

+4
-4
lines changed

resources/bash/cached.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_<?php echo $vars['script'] ?>()
22
{
3-
local cur script coms opts com
3+
local cur script coms opts com words
44
COMPREPLY=()
55
_get_comp_words_by_ref -n : cur words
66

resources/bash/default.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_symfony()
22
{
3-
local cur script com opts
3+
local cur script com opts words
44
COMPREPLY=()
55
_get_comp_words_by_ref -n : cur words
66

tests/fixtures/bash/cached.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_acme()
22
{
3-
local cur script coms opts com
3+
local cur script coms opts com words
44
COMPREPLY=()
55
_get_comp_words_by_ref -n : cur words
66

tests/fixtures/bash/default.txt

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
_symfony()
22
{
3-
local cur script com opts
3+
local cur script com opts words
44
COMPREPLY=()
55
_get_comp_words_by_ref -n : cur words
66

0 commit comments

Comments
 (0)