summaryrefslogtreecommitdiff
path: root/pp_ctl.c
diff options
context:
space:
mode:
authorGurusamy Sarathy <gsar@cpan.org>1999-12-28 19:55:56 +0000
committerGurusamy Sarathy <gsar@cpan.org>1999-12-28 19:55:56 +0000
commit39eb404022bff33467711717d8de9566914a79f1 (patch)
treea35d37a29b5dd3ed938a5943dad60389ef1f0c13 /pp_ctl.c
parent5db1039675bdeda8d9e4e8a1462abefb8ede0419 (diff)
downloadperl-39eb404022bff33467711717d8de9566914a79f1.tar.gz
range operator does magical string increment iff both operands
are non-numbers, from Tom Phoenix <rootbeer@redcat.com>; fixed the "foreach (RANGE)" case as well p4raw-id: //depot/perl@4730
Diffstat (limited to 'pp_ctl.c')
-rw-r--r--pp_ctl.c10
1 files changed, 8 insertions, 2 deletions
diff --git a/pp_ctl.c b/pp_ctl.c
index c028b4eca5..34e18b5f32 100644
--- a/pp_ctl.c
+++ b/pp_ctl.c
@@ -997,7 +997,9 @@ PP(pp_flop)
mg_get(right);
if (SvNIOKp(left) || !SvPOKp(left) ||
- (looks_like_number(left) && *SvPVX(left) != '0') )
+ SvNIOKp(right) || !SvPOKp(right) ||
+ (looks_like_number(left) && *SvPVX(left) != '0' &&
+ looks_like_number(right) && *SvPVX(right) != '0'))
{
if (SvNV(left) < IV_MIN || SvNV(right) > IV_MAX)
DIE(aTHX_ "Range iterator outside integer range");
@@ -1674,7 +1676,11 @@ PP(pp_enteriter)
if (SvTYPE(cx->blk_loop.iterary) != SVt_PVAV) {
dPOPss;
if (SvNIOKp(sv) || !SvPOKp(sv) ||
- (looks_like_number(sv) && *SvPVX(sv) != '0')) {
+ SvNIOKp(cx->blk_loop.iterary) || !SvPOKp(cx->blk_loop.iterary) ||
+ (looks_like_number(sv) && *SvPVX(sv) != '0' &&
+ looks_like_number((SV*)cx->blk_loop.iterary) &&
+ *SvPVX(cx->blk_loop.iterary) != '0'))
+ {
if (SvNV(sv) < IV_MIN ||
SvNV((SV*)cx->blk_loop.iterary) >= IV_MAX)
DIE(aTHX_ "Range iterator outside integer range");