Fixed: No owner specified notices
Fixed: No owner specified notices

When no owner is specified in the line, PHP will return a notice that it cannot read $regs[2] (it does not exist).
It is not a critical bug, but it is very annoying.

I fixed this behavior by first checking if $regs[2] isset.

--- a/include/git/projectlist/ProjectListFile.class.php
+++ b/include/git/projectlist/ProjectListFile.class.php
@@ -130,9 +130,11 @@
 			if (preg_match('/^([^\s]+)(\s.+)?$/', $line, $regs)) {
 				$data = array();
 				$data['project'] = $regs[1];
-				$owner = trim($regs[2]);
-				if (!empty($owner)) {
-					$data['owner'] = $owner;
+				if (isset($regs[2])){
+					$owner = trim($regs[2]);
+					if (!empty($owner)) {
+						$data['owner'] = $owner;
+					}
 				}
 				$this->fileContents[] = $data;
 			}

comments