Skip to content

Fixed - was not working for variables in last line of heredoc. #14

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Mar 19, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -413,7 +413,6 @@ sub get_token_content
if ( $token->isa('PPI::Token::HereDoc') )
{
my @heredoc = $token->heredoc();
pop( @heredoc ); # Remove the heredoc termination tag.
$content = join( '', @heredoc );
}
elsif ( $token->isa('PPI::Token::Quote' ) )
Expand Down
4 changes: 4 additions & 0 deletions t/10-extract_variables.t
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,10 @@ my $tests =
string => 'A test $variable string',
expected => [ '$variable' ],
},
{
string => "A test string\n with \$variable",
expected => [ '$variable' ],
},
{
string => 'A test $variable $variable string',
expected => [ '$variable' ],
Expand Down
9 changes: 9 additions & 0 deletions t/ValuesAndExpressions/PreventSQLInjection.run
Original file line number Diff line number Diff line change
Expand Up @@ -104,6 +104,15 @@ my $heredoc = <<__HERE__
FROM $table
__HERE__

## name Heredoc with variable in last line
## failures 1
## cut

my $heredoc = <<__HERE__
SELECT
FROM $table
__HERE__

## name Double-quoted heredoc with multiple variables.
## failures 1
## cut
Expand Down