summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--gv.c6
-rw-r--r--pp.c2
-rw-r--r--sv.c14
-rw-r--r--t/lib/warnings/pp_hot2
-rw-r--r--t/op/gv.t12
5 files changed, 14 insertions, 22 deletions
diff --git a/gv.c b/gv.c
index 0010da7d3e..6d8bbb550d 100644
--- a/gv.c
+++ b/gv.c
@@ -2039,13 +2039,9 @@ Perl_gv_fullname4(pTHX_ SV *sv, const GV *gv, const char *prefix, bool keepmain)
PERL_ARGS_ASSERT_GV_FULLNAME4;
- if (!hv) {
- SvOK_off(sv);
- return;
- }
sv_setpv(sv, prefix ? prefix : "");
- if ((name = HvNAME(hv))) {
+ if (hv && (name = HvNAME(hv))) {
const STRLEN len = HvNAMELEN(hv);
if (keepmain || strnNE(name, "main", len)) {
sv_catpvn_flags(sv,name,len,HvNAMEUTF8(hv)?SV_CATUTF8:SV_CATBYTES);
diff --git a/pp.c b/pp.c
index 7114f89bdb..5d5b6aee58 100644
--- a/pp.c
+++ b/pp.c
@@ -165,7 +165,7 @@ S_rv2gv(pTHX_ SV *sv, const bool vivify_sv, const bool strict,
sv = SvRV(sv);
if (SvTYPE(sv) == SVt_PVIO) {
GV * const gv = MUTABLE_GV(sv_newmortal());
- gv_init(gv, 0, "", 0, 0);
+ gv_init(gv, 0, "$__ANONIO__", 11, 0);
GvIOp(gv) = MUTABLE_IO(sv);
SvREFCNT_inc_void_NN(sv);
sv = MUTABLE_SV(gv);
diff --git a/sv.c b/sv.c
index 1a8c029cbc..84dabae98d 100644
--- a/sv.c
+++ b/sv.c
@@ -2958,18 +2958,12 @@ Perl_sv_2pv_flags(pTHX_ register SV *const sv, STRLEN *const lp, const I32 flags
gv_efullname3(buffer, gv, "*");
SvFLAGS(gv) |= wasfake;
- if (SvPOK(buffer)) {
- if (lp) {
+ assert(SvPOK(buffer));
+ if (lp) {
*lp = SvCUR(buffer);
- }
- if ( SvUTF8(buffer) ) SvUTF8_on(sv);
- return SvPVX(buffer);
- }
- else {
- if (lp)
- *lp = 0;
- return (char *)"";
}
+ if ( SvUTF8(buffer) ) SvUTF8_on(sv);
+ return SvPVX(buffer);
}
if (lp)
diff --git a/t/lib/warnings/pp_hot b/t/lib/warnings/pp_hot
index a0b9b10139..e53832a371 100644
--- a/t/lib/warnings/pp_hot
+++ b/t/lib/warnings/pp_hot
@@ -116,7 +116,7 @@ my $fh = *STDOUT{IO};
close STDOUT or die "Can't close STDOUT";
print $fh "Shouldn't print anything, but shouldn't SEGV either\n";
EXPECT
-print() on closed filehandle at - line 7.
+print() on closed filehandle $__ANONIO__ at - line 7.
########
# pp_hot.c [pp_print]
package foo;
diff --git a/t/op/gv.t b/t/op/gv.t
index 8c0e31106c..31e4ca0fd6 100644
--- a/t/op/gv.t
+++ b/t/op/gv.t
@@ -598,10 +598,11 @@ foreach my $type (qw(integer number string)) {
# RT #60954 anonymous glob should be defined, and not coredump when
# stringified. The behaviours are:
#
-# defined($glob) "$glob"
-# 5.8.8 false "" with uninit warning
-# 5.10.0 true (coredump)
-# 5.12.0 true ""
+# defined($glob) "$glob" $glob .= ...
+# 5.8.8 false "" with uninit warning "" with uninit warning
+# 5.10.0 true (coredump) (coredump)
+# 5.1[24] true "" "" with uninit warning
+# 5.16 true "*__ANON__::..." "*__ANON__::..."
{
my $io_ref = *STDOUT{IO};
@@ -613,7 +614,8 @@ foreach my $type (qw(integer number string)) {
use warnings;
my $str = "$glob";
is($warn, '', "RT #60954 anon glob stringification shouldn't warn");
- is($str, '', "RT #60954 anon glob stringification should be empty");
+ is($str, '*__ANON__::$__ANONIO__',
+ "RT #60954/#96326 anon glob stringification");
}
# [perl #71254] - Assigning a glob to a variable that has a current