summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--mg.c8
-rw-r--r--t/op/groups.t16
2 files changed, 22 insertions, 2 deletions
diff --git a/mg.c b/mg.c
index bd71ce15b7..680097cf94 100644
--- a/mg.c
+++ b/mg.c
@@ -1240,7 +1240,13 @@ Perl_magic_get(pTHX_ SV *sv, MAGIC *mg)
Safefree(gary);
}
}
- (void)SvIOK_on(sv); /* what a wonderful hack! */
+
+ /*
+ Set this to avoid warnings when the SV is used as a number.
+ Avoid setting the public IOK flag so that serializers will
+ use the PV.
+ */
+ (void)SvIOKp_on(sv); /* what a wonderful hack! */
#endif
break;
case '0':
diff --git a/t/op/groups.t b/t/op/groups.t
index 8ffb8ad051..e80c18241d 100644
--- a/t/op/groups.t
+++ b/t/op/groups.t
@@ -51,8 +51,22 @@ sub Test {
my %basegroup = basegroups( $pwgid, $pwgnam );
my @extracted_supplementary_groups = remove_basegroup( \ %basegroup, \ @extracted_groups );
- plan 3;
+ plan 4;
+ {
+ my @warnings = do {
+ my @w;
+ local $SIG{'__WARN__'} = sub { push @w, @_ };
+
+ use warnings;
+ my $v = $( + 1;
+ $v = $) + 1;
+
+ @w;
+ };
+
+ is ("@warnings", "", 'Neither $( nor $) trigger warnings when used as number.' );
+ }
# Test: The supplementary groups in $( should match the
# getgroups(2) kernal API call.