From: Father Chrysostomos Date: Fri, 31 Aug 2012 16:29:21 +0000 (-0700) Subject: s/${foo#}//e should be an error X-Git-Tag: upstream/5.20.0~5525 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=90a536e1429209983a0eb4bcdfe728d82726b3e9;p=platform%2Fupstream%2Fperl.git s/${foo#}//e should be an error See also the previous commit. This one was caused by 9c74ccc. Again, we can’t just check whether PL_lex_repl has the SvEVALED flag set (which means we are in s///e), but must also check whether PL_lex_repl == PL_linestr (which means we are in the replacement part of s///e). --- diff --git a/t/base/lex.t b/t/base/lex.t index c974797..93985e7 100644 --- a/t/base/lex.t +++ b/t/base/lex.t @@ -1,6 +1,6 @@ #!./perl -print "1..73\n"; +print "1..74\n"; $x = 'x'; @@ -363,3 +363,7 @@ $_ = "not ok 73"; $x{3} = "not "; eval 's/${\%x}{3}//e'; print "$_ - s//\${\\%x}{3}/e\n"; + +eval 's/${foo#}//e'; +print "not " unless $@; +print "ok 74 - s/\${foo#}//e\n"; diff --git a/toke.c b/toke.c index 9b765e6..ec633c4 100644 --- a/toke.c +++ b/toke.c @@ -5279,7 +5279,7 @@ Perl_yylex(pTHX) s = d; if (in_comment && d == PL_bufend && PL_lex_state == LEX_INTERPNORMAL - && PL_lex_inwhat == OP_SUBST && PL_lex_repl + && PL_lex_inwhat == OP_SUBST && PL_lex_repl == PL_linestr && SvEVALED(PL_lex_repl) && d[-1] == '}') s--; else incline(s); }