Skip to content
Browse files

Fixed bug #20131 : PHP errors in svnblame report, if there are files …

…not under version control
  • Loading branch information...
1 parent ceaa3ce commit 9814996ff90bdf44acb160f7e081070f12ef2e86 @gsherwood gsherwood committed Nov 25, 2013
Showing with 8 additions and 5 deletions.
  1. +7 −5 CodeSniffer/Reports/VersionControl.php
  2. +1 −0 package.xml
View
12 CodeSniffer/Reports/VersionControl.php
@@ -63,11 +63,13 @@ public function generate(
foreach ($report['files'] as $filename => $file) {
$blames = $this->getBlameContent($filename);
-
foreach ($file['messages'] as $line => $lineErrors) {
- $author = $this->getAuthor($blames[($line - 1)]);
- if ($author === false) {
- continue;
+ $author = 'Unknown';
+ if (isset($blames[($line - 1)]) === true) {
+ $blameAuthor = $this->getAuthor($blames[($line - 1)]);
+ if ($blameAuthor !== false) {
+ $author = $blameAuthor;
+ }
}
if (isset($authors[$author]) === false) {
@@ -104,7 +106,7 @@ public function generate(
foreach ($blames as $line) {
$author = $this->getAuthor($line);
if (false === $author) {
- continue;
+ $author = 'Unknown';
}
if (isset($authors[$author]) === false) {
View
1 package.xml
@@ -42,6 +42,7 @@ http://pear.php.net/dtd/package-2.0.xsd">
- Fixed bug #20097 : CLI.php throws error in php 5.2
- Fixed bug #20100 : incorrect Function mysql() has been deprecated report
- Fixed bug #20123 : PSR2 complains about an empty second statement in for-loop
+ - Fixed bug #20131 : PHP errors in svnblame report, if there are files not under version control
</notes>
<contents>
<dir name="/">

0 comments on commit 9814996

Please sign in to comment.
Something went wrong with that request. Please try again.