Problem with non-standard ports on Apache

Please report bugs here!

Moderator: Thorsten

Post Reply
oldman
Posts: 1
Joined: Tue May 22, 2007 11:38 pm

Problem with non-standard ports on Apache

Post by oldman »

Hi,
I've just installed pbpMyFAQ successfully on NetWare and Win32 platform; however when I use non-standard ports, f.e. 8080/8443 then I get the port appended a second time which breaks all links.
I looked further into it, and found that this is due to the logic in ./inc/Link.php where the port gets appended if non-standard, but at least with Apache I see that the port _is_ already appended with the HTTP_HOST var coming from Apache, and the function getSystemUri() appends it then for a second time. I've patched getSystemUri() to fix this:

Code: Select all

--- Link.php.orig	Thu Mar 29 20:56:28 2007
+++ Link.php	Wed May 23 01:20:55 2007
@@ -341,7 +341,7 @@
     {
         // $_SERVER['HTTP_HOST'] is the name of the website or virtual host name
         $sysUri = PMF_Link::getSystemScheme().$_SERVER['HTTP_HOST'];
-        if (($_SERVER['SERVER_PORT'] != '80') && ($_SERVER['SERVER_PORT'] != '443')) {
+        if (($_SERVER['SERVER_PORT'] != '80') && ($_SERVER['SERVER_PORT'] != '443') && !strpos($_SERVER['HTTP_HOST'], ":")) {
             $sysUri .= ':'.$_SERVER['SERVER_PORT'];
         }
 
with this patch it works correctly; tested that on both NetWare and Win32 platforms.

here's a sample to demonstrate the issue:
http://www.gknw.net:8080/phpmyfaq/t.php

greets, Günter.
Thorsten
Posts: 15725
Joined: Tue Sep 25, 2001 11:14 am
Location: #phpmyfaq
Contact:

Post by Thorsten »

Hi,

thanks for the hint. We'll fix this issue as soon as possible.

bye
Thorsten
phpMyFAQ Maintainer and Lead Developer
amazon.de Wishlist
matteo
Posts: 572
Joined: Sun Nov 20, 2005 6:53 pm
Location: Italy

Re: Problem with non-standard ports on Apache

Post by matteo »

Hi Günter,
oldman wrote:with this patch it works correctly; tested that on both NetWare and Win32 platforms.
for your convenience, you can track the working progress about your issue here: https://thinkforge.org/tracker/index.ph ... 2&atid=169

Ciao,
Matteo
phpMyFAQ QA / Developer
Amazon.co.uk Wishlist
Post Reply