0

I host my pfpbb forum through Godaddy and am in the process of moving from one of their legacy servers to one of the current servers. Once all the code and databases were copied, most of my phpbb forum worked, but my file section did not. My file section is an add-on mod by Mohd called pafiledb. When I would click any of the links to do with the file section, the screen would just go completely blank.

I'm not a php programmer, but by painstakingly going through the code line by line, I have isolated three lines of code that were causing the problem, in two members: functions.php and functions_pafiledb.php. Once I commented these lines out, things seem to work, but I know that something will be broken somewhere, so I am looking for some advice.

The line in functions.php is the final line below:

$url = parse_url($file_url);  
$host = $url['host'];   
$path = $url['path'];  
$port = (!empty($url['port'])) ? $url['port'] : 80;  
$fp = @fsockopen($host, $port, &$errno, &$errstr, 20); 

The first problematic line in functions_pafiledb.php is:

$this->category_nav($this->cat_rowset[$cat_id]['cat_parent'], &$cat_nav);

and the second line is:

$this->category_nav($this->cat_rowset[$parent_id]['cat_parent'], &$cat_nav);

I have saved both files, with the code still commented out - look for "Rob", here:
http://www.rockabilly.net/temp/functions-php.zip

Anyone have any ideas?
Thanks,
Rob

  • 2
    Enable error reporting and check your error log. `error_reporting(E_ALL);` at the top of your script. The `@` suppresses errors, so you'll need to remove that too. My suspicion is that the newer server uses a modern version of PHP that doesn't support call-time pass by reference -- the `&` in `&$errno, &$errstr, &$cat_nav`. It may be enough to just remove those `&`, but you need to check the error log. Find out your new PHP version, and have a look at the appropriate upgrade guide. http://php.net/manual/en/migration54.incompatible.php, http://php.net/manual/en/migration54.php – Michael Berkowski Nov 24 '15 at 03:23
  • The old version = 5.2.17, the new version = 5.4.45 Removing the @ and & signs did the trick. Enabling error messages caused a ton of stuff to come onto the page, so I will have to go through the list one by one to see if I can bring the code up to standards. Thanks a lot for your help and advice, it was spot on. – The Robman Nov 24 '15 at 04:43
  • If this was an old PHP application like phpbb, there's a good chance it was not coded to avoid the E_NOTICE and maybe E_WARNING messages. If you attempt to fix everything, focus first on the E_WARNING (or E_ERROR) before the notices, but if it's a large application it may not be practical to get everything. Pay attention also to other E_DEPRECATED warnings because those would indicate things likely to break the next time you have to upgrade a PHP version. – Michael Berkowski Nov 24 '15 at 12:12
  • it is indeed phpbb, and not even the latest version but an older version. Unfortunately, my version is heavily modded so it hasn't been practical to update to the latest version. I will follow your advice because who knows what version 5.5.x will bring? Thanks again. – The Robman Nov 24 '15 at 13:43
  • Luckily, you can find out what 5.5 (which is already an old version) will bring, and it isn't too different from 5.4, save for the deprecation of mysql_*() http://php.net/manual/en/migration55.php – Michael Berkowski Nov 24 '15 at 13:53

0 Answers0