summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFather Chrysostomos <sprout@cpan.org>2012-04-21 19:12:21 -0700
committerFather Chrysostomos <sprout@cpan.org>2012-05-29 09:41:14 -0700
commit1b08e05188c16b744b6f2b0e2a2321db606eb88d (patch)
tree92df09ea5bff2eab0e09893318ca4e64ff4ec3c2
parentedba6325a4364c7c1a9869871bb3d0be8e33acf7 (diff)
downloadperl-1b08e05188c16b744b6f2b0e2a2321db606eb88d.tar.gz
[perl #97478] Make ‘Can’t find opnumber’ UTF-8- and null-clean
-rw-r--r--pp.c5
-rw-r--r--t/comp/proto.t12
2 files changed, 15 insertions, 2 deletions
diff --git a/pp.c b/pp.c
index 908d16d50a..4858d99265 100644
--- a/pp.c
+++ b/pp.c
@@ -439,7 +439,10 @@ PP(pp_prototype)
if (strnEQ(s, "CORE::", 6)) {
const int code = keyword(s + 6, SvCUR(TOPs) - 6, 1);
if (!code || code == -KEY_CORE)
- DIE(aTHX_ "Can't find an opnumber for \"%s\"", s+6);
+ DIE(aTHX_ "Can't find an opnumber for \"%"SVf"\"",
+ SVfARG(newSVpvn_flags(
+ s+6, SvCUR(TOPs)-6, SvFLAGS(TOPs) & SVf_UTF8
+ )));
{
SV * const sv = core_prototype(NULL, s + 6, code, NULL);
if (sv) ret = sv;
diff --git a/t/comp/proto.t b/t/comp/proto.t
index 04fea69952..8e9821f1b5 100644
--- a/t/comp/proto.t
+++ b/t/comp/proto.t
@@ -18,7 +18,7 @@ BEGIN {
# strict
use strict;
-print "1..177\n";
+print "1..179\n";
my $i = 1;
@@ -413,6 +413,16 @@ print "# CORE:Foo => ($p), \$@ => '$@'\nnot "
if defined ($p = eval { prototype('CORE::Foo') or 1 }) or $@ !~ /^Can't find an opnumber/;
print "ok ", $i++, "\n";
+eval { prototype("CORE::a\0b") };
+print "# CORE::a\\0b: \$@ => '$@'\nnot "
+ if $@ !~ /^Can't find an opnumber for "a\0b"/;
+print "ok ", $i++, "\n";
+
+eval { prototype("CORE::\x{100}") };
+print "# CORE::\\x{100}: => ($p), \$@ => '$@'\nnot "
+ if $@ !~ /^Can't find an opnumber for "\x{100}"/;
+print "ok ", $i++, "\n";
+
# correctly note too-short parameter lists that don't end with '$',
# a possible regression.