Skip to content

Commit

Permalink
PHP_CodeSniffer_File::getTokensAsString() now detects incorrect lengt…
Browse files Browse the repository at this point in the history
…h value (request #19313)
  • Loading branch information
gsherwood committed Mar 5, 2012
1 parent 53ec9ec commit c946650
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 0 deletions.
4 changes: 4 additions & 0 deletions CodeSniffer/File.php
Original file line number Diff line number Diff line change
Expand Up @@ -2435,6 +2435,10 @@ public function getTokensAsString($start, $length)
{
$str = '';
$end = ($start + $length);
if ($end > $this->numTokens) {
$end = $this->numTokens;
}

for ($i = $start; $i < $end; $i++) {
$str .= $this->_tokens[$i]['content'];
}
Expand Down
1 change: 1 addition & 0 deletions package.xml
Original file line number Diff line number Diff line change
Expand Up @@ -1880,6 +1880,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
-- Thanks to Sebastian Bergmann for the patch
- Added PHP_CodeSniffer_Tokens::$bracketTokens to give sniff writers fast access to open and close bracket tokens
- Fixed an issue in AbstractPatternSniff where EOL tokens were not being correctly checked in some cases
- PHP_CodeSniffer_File::getTokensAsString() now detects incorrect length value (request #19313)
- Fixed bug #19114 : CodeSniffer checks extension even for single file
- Fixed bug #19171 : Show sniff codes option is ignored by some report types
-- Thanks to Dominic Scheirlinck for the patch
Expand Down

0 comments on commit c946650

Please sign in to comment.