[1/5] 404.php: Squelch warning on empty PATH_INFO

Message ID 20170227184955.25495-1-lfleischer@archlinux.org
State Accepted, archived
Headers show
Series [1/5] 404.php: Squelch warning on empty PATH_INFO | expand

Commit Message

Lukas Fleischer Feb. 27, 2017, 6:49 p.m. UTC
Signed-off-by: Lukas Fleischer <lfleischer@archlinux.org>
---
 web/html/404.php | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Patch

diff --git a/web/html/404.php b/web/html/404.php
index 757c485..9f81d11 100644
--- a/web/html/404.php
+++ b/web/html/404.php
@@ -5,7 +5,7 @@  set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
 $path = $_SERVER['PATH_INFO'];
 $tokens = explode('/', $path);
 
-if (preg_match('/^([a-z0-9][a-z0-9.+_-]*?)(\.git)?$/', $tokens[1], $matches)) {
+if (isset($tokens[1]) && preg_match('/^([a-z0-9][a-z0-9.+_-]*?)(\.git)?$/', $tokens[1], $matches)) {
 	$gitpkg = $matches[1];
 	if (pkg_from_name($gitpkg)) {
 		$gitcmd = 'git clone ' . sprintf(config_get('options', 'git_clone_uri_anon'), htmlspecialchars($gitpkg));