From: Vincent Pit Date: Sat, 22 Mar 2008 13:37:42 +0000 (+0100) Subject: Re: [PATCH] Double warning with perl -we 'my $a; substr $a, 0, 10, X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=502d9230ec570254fed51ae721c1da50944a5cbf;p=p5sagit%2Fp5-mst-13.2.git Re: [PATCH] Double warning with perl -we 'my $a; substr $a, 0, 10, Message-ID: <47E4FD96.6080304@profvince.com> p4raw-id: //depot/perl@33557 --- diff --git a/pp.c b/pp.c index 5b09c08..3551d8f 100644 --- a/pp.c +++ b/pp.c @@ -3178,6 +3178,8 @@ PP(pp_substr) repl = SvPV_const(repl_sv_copy, repl_len); repl_is_utf8 = DO_UTF8(repl_sv_copy) && SvCUR(sv); } + if (!SvOK(sv)) + sv_setpvs(sv, ""); sv_insert(sv, pos, rem, repl, repl_len); if (repl_is_utf8) SvUTF8_on(sv); diff --git a/t/lib/warnings/9uninit b/t/lib/warnings/9uninit index 9316dc8..8c70a14 100644 --- a/t/lib/warnings/9uninit +++ b/t/lib/warnings/9uninit @@ -873,7 +873,6 @@ Use of uninitialized value $g2 in substr at - line 7. Use of uninitialized value $m2 in substr at - line 7. Use of uninitialized value $g1 in substr at - line 7. Use of uninitialized value $m1 in substr at - line 7. -Use of uninitialized value $m1 in substr at - line 7. Use of uninitialized value $g1 in substr at - line 8. Use of uninitialized value $m1 in substr at - line 8. Use of uninitialized value in scalar assignment at - line 8.