patch 8.2.3908: cannot use a script-local function for 'foldtext'

Problem:    Cannot use a script-local function for 'foldtext'.
Solution:   Expand "s:" and "<SID>". (Yegappan Lakshmanan, closes #9411)
diff --git a/src/optionstr.c b/src/optionstr.c
index c69354e..ae584d0 100644
--- a/src/optionstr.c
+++ b/src/optionstr.c
@@ -2310,6 +2310,7 @@
 # endif
 # ifdef FEAT_FOLDING
 	    varp == &curwin->w_p_fde ||
+	    varp == &curwin->w_p_fdt ||
 # endif
 	    gvarp == &p_fex ||
 # ifdef FEAT_FIND_ID
@@ -2341,8 +2342,10 @@
 	    p_opt = &p_dex;
 # endif
 # ifdef FEAT_FOLDING
-	if(varp == &curwin->w_p_fde)	// 'foldexpr'
+	if (varp == &curwin->w_p_fde)	// 'foldexpr'
 	    p_opt = &curwin->w_p_fde;
+	if (varp == &curwin->w_p_fdt)	// 'foldtext'
+	    p_opt = &curwin->w_p_fdt;
 # endif
 	if (gvarp == &p_fex)	// 'formatexpr'
 	    p_opt = &curbuf->b_p_fex;
diff --git a/src/strings.c b/src/strings.c
index 6a6b0f4..3dd6856 100644
--- a/src/strings.c
+++ b/src/strings.c
@@ -905,8 +905,6 @@
 	set_vim_var_nr(VV_KEY, idx);
 	if (filter_map_one(&tv, expr, filtermap, &newtv, &rem) == FAIL
 		|| did_emsg)
-	    break;
-	if (did_emsg)
 	{
 	    clear_tv(&newtv);
 	    clear_tv(&tv);
diff --git a/src/testdir/test_blob.vim b/src/testdir/test_blob.vim
index 3ce9575..69c8696 100644
--- a/src/testdir/test_blob.vim
+++ b/src/testdir/test_blob.vim
@@ -37,6 +37,7 @@
       call assert_fails('VAR b = 0z001122.')
       call assert_fails('call get("", 1)', 'E896:')
       call assert_equal(0, len(test_null_blob()))
+      call assert_equal(0z, copy(test_null_blob()))
   END
   call CheckLegacyAndVim9Success(lines)
 endfunc
@@ -369,6 +370,14 @@
       add(test_null_blob(), 0x22)
   END
   call CheckDefExecAndScriptFailure(lines, 'E1131:')
+
+  let lines =<< trim END
+      let b = 0zDEADBEEF
+      lockvar b
+      call add(b, 0)
+      unlockvar b
+  END
+  call CheckScriptFailure(lines, 'E741:')
 endfunc
 
 func Test_blob_empty()
@@ -445,6 +454,9 @@
       remove(b, 0)
   END
   call CheckScriptFailure(lines, 'E741:')
+
+  call assert_fails('echo remove(0z1020, [])', 'E745:')
+  call assert_fails('echo remove(0z1020, 0, [])', 'E745:')
 endfunc
 
 func Test_blob_read_write()
@@ -474,6 +486,7 @@
       call assert_equal(0zADEF, filter(0zDEADBEEF, 'v:key % 2'))
   END
   call CheckLegacyAndVim9Success(lines)
+  call assert_fails('echo filter(0z10, "a10")', 'E121:')
 endfunc
 
 " map() item in blob
@@ -489,6 +502,7 @@
       call map(0z00, '[9]')
   END
   call CheckLegacyAndVim9Failure(lines, 'E978:')
+  call assert_fails('echo map(0z10, "a10")', 'E121:')
 endfunc
 
 func Test_blob_index()
diff --git a/src/testdir/test_expr.vim b/src/testdir/test_expr.vim
index ba2e259..8a65a89 100644
--- a/src/testdir/test_expr.vim
+++ b/src/testdir/test_expr.vim
@@ -405,6 +405,7 @@
       call assert_equal('[00000あiう]', printf('[%010.7S]', 'あiう'))
 
       call assert_equal('1%', printf('%d%%', 1))
+      call assert_notequal('', printf('%p', "abc"))
   END
   call CheckLegacyAndVim9Success(lines)
 
diff --git a/src/testdir/test_filter_map.vim b/src/testdir/test_filter_map.vim
index 1767a99..6cde453 100644
--- a/src/testdir/test_filter_map.vim
+++ b/src/testdir/test_filter_map.vim
@@ -183,6 +183,7 @@
     call assert_equal('', map('', "v:val == 'a'"))
     call assert_equal('', map(test_null_string(), "v:val == 'a'"))
     call assert_fails('echo map("abc", "10")', 'E928:')
+    call assert_fails('echo map("abc", "a10")', 'E121:')
   END
   call CheckLegacyAndVim9Success(lines)
 
diff --git a/src/testdir/test_fold.vim b/src/testdir/test_fold.vim
index d35b7c8..e3b6b6e 100644
--- a/src/testdir/test_fold.vim
+++ b/src/testdir/test_fold.vim
@@ -1408,4 +1408,35 @@
   bw!
 endfunc
 
+" Test for using a script-local function for 'foldtext'
+func Test_foldtext_scriptlocal_func()
+  func! s:FoldText()
+    let g:FoldTextArgs = [v:foldstart, v:foldend]
+    return foldtext()
+  endfunc
+  new | only
+  call setline(1, range(50))
+  let g:FoldTextArgs = []
+  set foldmethod=manual
+  set foldtext=s:FoldText()
+  norm! 4Gzf4j
+  redraw!
+  call assert_equal(expand('<SID>') .. 'FoldText()', &foldtext)
+  call assert_equal([4, 8], g:FoldTextArgs)
+  set foldtext&
+  bw!
+  new | only
+  call setline(1, range(50))
+  let g:FoldTextArgs = []
+  set foldmethod=manual
+  set foldtext=<SID>FoldText()
+  norm! 8Gzf4j
+  redraw!
+  call assert_equal(expand('<SID>') .. 'FoldText()', &foldtext)
+  call assert_equal([8, 12], g:FoldTextArgs)
+  set foldtext&
+  bw!
+  delfunc s:FoldText
+endfunc
+
 " vim: shiftwidth=2 sts=2 expandtab
diff --git a/src/testdir/test_listdict.vim b/src/testdir/test_listdict.vim
index e7b6588..fbb917b 100644
--- a/src/testdir/test_listdict.vim
+++ b/src/testdir/test_listdict.vim
@@ -1163,6 +1163,7 @@
 
   let d = {'a': 'A', 'b': 'B'}
   call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'error')", 'E737:')
+  call assert_fails("call extend(d, {'b': 0}, [])", 'E730:')
   call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 'xxx')", 'E475:')
   if has('float')
     call assert_fails("call extend(d, {'b': 0, 'c':'C'}, 1.2)", 'E475:')
diff --git a/src/version.c b/src/version.c
index 7b8b0a6..64086c3 100644
--- a/src/version.c
+++ b/src/version.c
@@ -750,6 +750,8 @@
 static int included_patches[] =
 {   /* Add new patch number below this line */
 /**/
+    3908,
+/**/
     3907,
 /**/
     3906,