M.J.T. Guy [Mon, 7 Jul 1997 12:37:51 +0000 (00:37 +1200)]
Subject: hmmm.
Isn't it weird that
substr("foo", -1000)
is silently converted to substr("foo", 0, 3) while
substr("foo", 1000)
always causes RETPUSHUNDEF and possibly a warning? I'd say there's
too much code in pp.c:pp_substr.
Credited: Jarkko Hietaniemi <jhi@iki.fi>
Credited: Tim Bunce <Tim.Bunce@ig.co.uk>
p5p-msgid:
9707072304.AA01069@toad.ig.co.uk
private-msgid:
199707100655.JAA14924@alpha.hut.fi
pos = POPi - arybase;
sv = POPs;
tmps = SvPV(sv, curlen);
- if (pos < 0) {
+ if (pos < 0)
pos += curlen + arybase;
- if (pos < 0 && MAXARG < 3)
- pos = 0;
- }
if (pos < 0 || pos > curlen) {
if (dowarn || lvalue)
warn("substr outside of string");