mirror of
https://github.com/Perl/perl5.git
synced 2026-01-26 16:39:36 +00:00
[perl #36434] assigning shared consts (eg __PACKAGE__) to magic vars
p4raw-id: //depot/perl@25032
This commit is contained in:
parent
a4d60858fc
commit
d8084ca508
7
sv.c
7
sv.c
@ -4984,7 +4984,12 @@ Perl_sv_magic(pTHX_ register SV *sv, SV *obj, int how, const char *name, I32 nam
|
||||
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
|
||||
|
||||
@ -36,7 +36,7 @@ sub skip {
|
||||
return 1;
|
||||
}
|
||||
|
||||
print "1..56\n";
|
||||
print "1..57\n";
|
||||
|
||||
$Is_MSWin32 = $^O eq 'MSWin32';
|
||||
$Is_NetWare = $^O eq 'NetWare';
|
||||
@ -432,9 +432,12 @@ ok "@+" eq "10 1 6 10";
|
||||
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 "# $@";
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user