Skip to content

Commit 502d923

Browse files
vpitrgs
authored andcommitted
Re: [PATCH] Double warning with perl -we 'my $a; substr $a, 0, 10,
Message-ID: <[email protected]> p4raw-id: //depot/perl@33557
1 parent d3153aa commit 502d923

File tree

2 files changed

+2
-1
lines changed

2 files changed

+2
-1
lines changed

pp.c

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3178,6 +3178,8 @@ PP(pp_substr)
31783178
repl = SvPV_const(repl_sv_copy, repl_len);
31793179
repl_is_utf8 = DO_UTF8(repl_sv_copy) && SvCUR(sv);
31803180
}
3181+
if (!SvOK(sv))
3182+
sv_setpvs(sv, "");
31813183
sv_insert(sv, pos, rem, repl, repl_len);
31823184
if (repl_is_utf8)
31833185
SvUTF8_on(sv);

t/lib/warnings/9uninit

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -873,7 +873,6 @@ Use of uninitialized value $g2 in substr at - line 7.
873873
Use of uninitialized value $m2 in substr at - line 7.
874874
Use of uninitialized value $g1 in substr at - line 7.
875875
Use of uninitialized value $m1 in substr at - line 7.
876-
Use of uninitialized value $m1 in substr at - line 7.
877876
Use of uninitialized value $g1 in substr at - line 8.
878877
Use of uninitialized value $m1 in substr at - line 8.
879878
Use of uninitialized value in scalar assignment at - line 8.

0 commit comments

Comments
 (0)