[PATCH v2] Fix for lighttpd with empty $_SERVER['PATH_INFO']

65 views
Skip to first unread message

Uli

unread,
May 4, 2008, 12:08:48 PM5/4/08
to qb user discussion list

It seems like on (my?) lighttpd $_SERVER['PATH_INFO'] is set, but empty
which results in qb always showing the front page.

Fix this by also checking for an empty PATH_INFO before using it.

Signed-off-by: Uli Schlachter <psy...@znc.in>
---
lib/qbURL.php | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/lib/qbURL.php b/lib/qbURL.php
index 6f3e96f..3167af8 100644
--- a/lib/qbURL.php
+++ b/lib/qbURL.php
@@ -154,7 +154,7 @@ class qbURL {
public static function getVFile() {
$path = QB_URIPATH;
// PATH_INFO is set for Apache's "Alias" directive, it has precedence.
- if (isset($_SERVER['PATH_INFO']))
+ if (isset($_SERVER['PATH_INFO']) && $_SERVER['PATH_INFO'] != '')
$path = $_SERVER['PATH_INFO'];
else if (qbString::startsWith(self::getHandler(), $path))
$path = substr($path, strlen(self::getHandler()));
--
-----BEGIN GEEK CODE BLOCK-----
Version: 3.1
G d- s:- a--- C+++>$ UL++>$ P L++>$ !E W++ !N o? K? w-- !O !M V? PS+ PE Y+
PGP++>+++ !t 5? !X !R-* tv+>- b+ DI->+ !D G e h+ r? y
------END GEEK CODE BLOCK------

Tim Weber

unread,
May 4, 2008, 1:11:46 PM5/4/08
to qb-u...@lists.scytale.name
On Sun, 2008-May-04 at 18:08:48 +0200, Uli wrote:
> It seems like on (my?) lighttpd $_SERVER['PATH_INFO'] is set, but
> empty which results in qb always showing the front page.
>
> Fix this by also checking for an empty PATH_INFO before using it.

Thanks, applied as 08989d87ca3f194a72ac4d16a52dfffa2a5be5b6.

I'm not 100% sure whether this can cause problems, for example if
PATH_INFO contains an empty string _on purpose_. But since qb should
work without PATH_INFO being set at all, I doubt that there will be
problems. Added a TODO item nevertheless.

By the way, http://www.invir.com/int-prog-cgivar.html looks nice.

Regards,

Tim.

Reply all
Reply to author
Forward
0 new messages