summaryrefslogtreecommitdiff
path: root/t
diff options
context:
space:
mode:
authorAlex Vandiver <alex@chmrr.net>2015-03-22 22:39:23 -0400
committerFather Chrysostomos <sprout@cpan.org>2015-03-27 12:46:40 -0700
commitb3089e964c0afaf7eb8d54aa5a912e4eb2e6c176 (patch)
tree45c2ac2a758506389d9499962e78b7765b07f8ad /t
parentd655d9a2c4d4884d0edf5364a3aafbc8b0b8de38 (diff)
downloadperl-b3089e964c0afaf7eb8d54aa5a912e4eb2e6c176.tar.gz
[perl #124113] Make check for multi-dimensional arrays be UTF8-aware
During parsing, toke.c checks if the user is attempting provide multiple indexes to an array index: $a[ $foo, $bar ]; However, while checking for word characters in variable names is aware of multi-byte characters if "use utf8" is enabled, the loop is only advanced one byte at a time, not one character at a time. As such, multibyte variables in array indexes incorrectly yield warnings: Passing malformed UTF-8 to "XPosixWord" is deprecated Malformed UTF-8 character (unexpected continuation byte 0x9d, with no preceding start byte) Switch the loop to advance character-by-character if UTF-8 semantics are in use.
Diffstat (limited to 't')
-rw-r--r--t/lib/warnings/toke10
1 files changed, 10 insertions, 0 deletions
diff --git a/t/lib/warnings/toke b/t/lib/warnings/toke
index 5d3110448e..018f188076 100644
--- a/t/lib/warnings/toke
+++ b/t/lib/warnings/toke
@@ -1521,3 +1521,13 @@ Use of literal control characters in variable names is deprecated at (eval 2) li
-a;
;-a;
EXPECT
+########
+# toke.c
+# [perl #124113] Compile-time warning with UTF8 variable in array index
+use warnings;
+use utf8;
+my $𝛃 = 0;
+my @array = (0);
+my $v = $array[ 0 + $𝛃 ];
+ $v = $array[ $𝛃 + 0 ];
+EXPECT