sv_force_normal_flags(sv, 0);
#endif
if (SvREADONLY(sv)) {
- if (IN_PERL_RUNTIME
+ if (
+ /* its okay to attach magic to shared strings; the subsequent
+ * upgrade to PVMG will unshare the string */
+ !(SvFAKE(sv) && SvTYPE(sv) < SVt_PVMG)
+
+ && IN_PERL_RUNTIME
&& how != PERL_MAGIC_regex_global
&& how != PERL_MAGIC_bm
&& how != PERL_MAGIC_fm
return 1;
}
-print "1..56\n";
+print "1..57\n";
$Is_MSWin32 = $^O eq 'MSWin32';
$Is_NetWare = $^O eq 'NetWare';
local @ISA;
local %ENV;
eval { push @ISA, __PACKAGE__ };
- ok( $@ eq '', 'Push a constant on a magic array', '#36434' );
+ ok( $@ eq '', 'Push a constant on a magic array');
$@ and print "# $@";
eval { %ENV = (PATH => __PACKAGE__) };
- ok( $@ eq '', 'Assign a constant to a magic hash', '#36434' );
+ ok( $@ eq '', 'Assign a constant to a magic hash');
+ $@ and print "# $@";
+ eval { my %h = qw(A B); %ENV = (PATH => (keys %h)[0]) };
+ ok( $@ eq '', 'Assign a shared key to a magic hash');
$@ and print "# $@";
}