summaryrefslogtreecommitdiff
path: root/pp_sort.c
diff options
context:
space:
mode:
authorDavid Mitchell <davem@iabyn.com>2010-05-08 21:25:47 +0100
committerDavid Mitchell <davem@iabyn.com>2010-05-08 21:28:27 +0100
commitbdbefedf6ca6c8253d0fccc6b9d99d7ae86dcd96 (patch)
tree32f5a51595ef89fa1c242783b2b2c1f73206f281 /pp_sort.c
parentaee036bb6c99459a0e305ff4008b983591ce8a4b (diff)
downloadperl-bdbefedf6ca6c8253d0fccc6b9d99d7ae86dcd96.tar.gz
RT #34604 didn't honour tied overloaded values
A tied hash lookup could return an overloaded object but sort wouldn't notice that it was overloaded because it checked for overload before doing mg_get().
Diffstat (limited to 'pp_sort.c')
-rw-r--r--pp_sort.c28
1 files changed, 9 insertions, 19 deletions
diff --git a/pp_sort.c b/pp_sort.c
index 12e77f9445..b0f2be1e83 100644
--- a/pp_sort.c
+++ b/pp_sort.c
@@ -1589,33 +1589,23 @@ PP(pp_sort)
if (!PL_sortcop) {
if (priv & OPpSORT_NUMERIC) {
if (priv & OPpSORT_INTEGER) {
- if (!SvIOK(*p1)) {
- if (SvAMAGIC(*p1))
- overloading = 1;
- else
- (void)sv_2iv(*p1);
- }
+ if (!SvIOK(*p1))
+ (void)sv_2iv_flags(*p1, SV_GMAGIC|SV_SKIP_OVERLOAD);
}
else {
- if (!SvNSIOK(*p1)) {
- if (SvAMAGIC(*p1))
- overloading = 1;
- else
- (void)sv_2nv(*p1);
- }
+ if (!SvNSIOK(*p1))
+ (void)sv_2nv_flags(*p1, SV_GMAGIC|SV_SKIP_OVERLOAD);
if (all_SIVs && !SvSIOK(*p1))
all_SIVs = 0;
}
}
else {
- if (!SvPOK(*p1)) {
- if (SvAMAGIC(*p1))
- overloading = 1;
- else
- (void)sv_2pv_flags(*p1, 0,
- SV_GMAGIC|SV_CONST_RETURN);
- }
+ if (!SvPOK(*p1))
+ (void)sv_2pv_flags(*p1, 0,
+ SV_GMAGIC|SV_CONST_RETURN|SV_SKIP_OVERLOAD);
}
+ if (SvAMAGIC(*p1))
+ overloading = 1;
}
p1++;
}