[aur-dev] [PATCH] Add check for if PATH_INFO exists

Lukas Fleischer lfleischer at archlinux.org
Tue Feb 7 20:43:56 UTC 2017


On Sun, 05 Feb 2017 at 00:35:57, Mark Weiman wrote:
> When running aurweb with the command line php server and / is visited, it will
> give an undefined index notice. This will add a check if it exists and will
> prevent the notice.
> 
> Signed-off-by: Mark Weiman <mark.weiman at markzz.com>
> ---
>  web/html/index.php | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/web/html/index.php b/web/html/index.php
> index 78ab6ad..3bdf281 100644
> --- a/web/html/index.php
> +++ b/web/html/index.php
> @@ -4,7 +4,7 @@ set_include_path(get_include_path() . PATH_SEPARATOR . '../lib');
>  include_once("aur.inc.php");
>  include_once("pkgfuncs.inc.php");
>  
> -$path = $_SERVER['PATH_INFO'];
> +$path = isset($_SERVER['PATH_INFO']) ? $_SERVER['PATH_INFO'] : "/";

I am not 100% convinced that this is a good idea. If somebody wants to
setup a "proper" web server running aurweb, this workaround makes it
harder to figure out what went wrong if PATH_INFO is unset due to some
misconfiguration. On the other hand, being able to run a quick test
using `php -S` is quite nice. Would you might adding a notice to the
commit message that this is specifically for `php -S`?

I also think that a note on how to test aurweb patches with `php -S`
should be added to the documentation. Maybe in INSTALL, before the
"real" setup instructions? Something like:

    For testing aurweb patches before submission, you can use [...]

    Note that you can only do limited testing using the PHP built-in web
    server. In particular, the SSH/Git interface will be unusable. For a
    detailed description on how to setup a full aurweb server, read the
    instructions below.

Opinions?

>  $tokens = explode('/', $path);
>  
>  if (config_get_bool('options', 'enable-maintenance') && (empty($tokens[1]) || ($tokens[1] != "css" && $tokens[1] != "images"))) {
> -- 
> 2.11.0


More information about the aur-dev mailing list