phpBB2Refugees.com Logo
Not affiliated with or endorsed by the phpBB Group

Register •  Login 

Continue the legacy...

Welcome to all phpBB2 Refugees!Wave Smilie

This site is intended to continue support for the legacy 2.x line of the phpBB2 bulletin board package. If you are a fan of phpBB2, please, by all means register, post, and help us out by offering your suggestions. We are primarily a community and support network. Our secondary goal is to provide a phpBB2 MOD Author and Styles area.

Upgrade for PHP 7.x

Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Search this topic... | Search phpBB2 Discussion... | Search Box
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Author Message
Vendethiel
Board Member



Joined: 26 Oct 2014

Posts: 188



PostPosted: Thu Jan 30, 2020 5:47 pm 
Post subject: Re: Upgrade for PHP 7.x

It's probably better to do that replacement before adding that function icon_smile.gif.
_________________
Developer on EzArena, the ADR premod.
Developer on Icy Phoenix, the phpBB hybrid cms.
Developer on IntegraMOD, the full-featured premod.
Help me archive premods on github! (fixed for recent PHPs).
Back to top
vlad77
Board Member



Joined: 31 May 2015

Posts: 122


flag
PostPosted: Sat Feb 29, 2020 6:22 pm 
Post subject: Re: Upgrade for PHP 7.x

There is an unpleasant change when upgrading to new php versions. See https://www.php.net/manual/en/migration54.incompatible.php
Quote:
Call-time pass by reference has been removed.
Description of the problem for one case http://www.phpbb2refugees.com/viewtopic.php?p=8320#8320

This means that you need to look in all &$ files, and if this is not a function definition of function foo(&$var), but its call to foo(&$a); then delete & and, if necessary, transfer it to the definition. Which is very laborious. Another way is to test the forum, which is not much easier, and does not guarantee that all function calls that are not working correctly are detected.

Regex search with negation helped. The regular expression to search for ^(?!.*function ).*&\$.*$ Searches for strings with &$ if there is no function in the string. That is, it finds &$ except for cases of defining functions.

Use an editor that supports bulk regular expression searches. I used a Far Manager and plugin to it RESearch.

In Russian, this is called a "life hack".
Back to top
Syd Lexia
Board Member



Joined: 19 Feb 2020

Posts: 19



PostPosted: Wed Mar 25, 2020 8:02 pm 
Post subject: Re: Upgrade for PHP 7.x

Hello. I run a website for fun and I am trying to get my forums to work on PHP 7.x. I make zero money off the site and pay the hosting fees out of my own pocket.

I had a thread here: http://www.phpbb2refugees.com/viewtopic.php?t=2557

But people stopped paying attention to it.

I have ZERO coding experience and people keep directing me to this thread as a source of how to fix my forums. This thread is very long and hard to follow and far too technical to be of any help to me.

My main problem right now is that posts show up as blank. I can see that people have fixed this, but I am unable to understand how to fix it. Is there anyone willing to give me simple, idiotproof step-by-step instructions on how to get my code working?

I can upload the entirety of the code minus the config file if necessary.

Alternatively, is there someone I could pay like $100 USD to just fix this for me? My forums have been down for over a month and it's really making me sad.
Back to top
lumpy burgertushie
Board Member



Joined: 19 Nov 2008

Posts: 250


flag
PostPosted: Thu Mar 26, 2020 6:15 am 
Post subject: Re: Upgrade for PHP 7.x

is there some particular reason that you do not want to upgrade to phpbb3?

that would be the easiest and quickest thing for you to do.

getting phpbb2 to work with php 7+ is a pretty major bit of code editing etc. as you have found.


coverting phpbb2 to phpbb3.3 is pretty straight forward and unless your board is huge should not take very long to do.

it can also be done offline if you wish.
it also does not touch your phpbb2 installation but creates a new phpbb3 board and converts the database leaving the old database intact.


robert
Back to top
Syd Lexia
Board Member



Joined: 19 Feb 2020

Posts: 19



PostPosted: Fri Mar 27, 2020 7:42 pm 
Post subject: Re: Upgrade for PHP 7.x

I like the aesthetic of my current board and I will never be able to get PHPbb 3 to look exactly like PHPbb 2. I tried an upgrade once years ago and I wasn't happy with how the new installation looked, so we aborted it. I'd rather just pay someone to fix my current installation.
Back to top
Syd Lexia
Board Member



Joined: 19 Feb 2020

Posts: 19



PostPosted: Mon Mar 30, 2020 10:26 pm 
Post subject: Re: Upgrade for PHP 7.x

clausl wrote:
1) for some reason all posts showed empty content.
I fixed that by removing the 'Replace naughty words' part from viewtopic.php which I do not use anyway


I do use the naughty words filter.

What would be a way to fix this code to work?

Code:
   // Replace naughty words
   //
   if (count($orig_word))
   {
      $post_subject = preg_replace($orig_word, $replacement_word, $post_subject);

      if ($user_sig != '')
      {
         $user_sig = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));
      }

      $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
   }
Back to top
vlad77
Board Member



Joined: 31 May 2015

Posts: 122


flag
PostPosted: Tue Mar 31, 2020 5:33 pm 
Post subject: Re: Upgrade for PHP 7.x

Syd Lexia wrote:
Alternatively, is there someone I could pay like $100 USD to just fix this for me? My forums have been down for over a month and it's really making me sad.
Hello. Write on this subject to me an email:
theprofit (at) mail . ru
Back to top
vlad77
Board Member



Joined: 31 May 2015

Posts: 122


flag
PostPosted: Sat Apr 25, 2020 8:44 am 
Post subject: Re: Upgrade for PHP 7.x

In the process of updating the Syd Lexia forum, 2 problems were not described. At least in this forum they could not be found about them.

Autocensor and selection after searching for found words.
Code:
open
viewtopic.php

find
      $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace('#\b(" . str_replace('\\', '\\\\', addslashes($highlight_match)) . ")\b#i', '<span style=\"color:#" . $theme['fontcolor3'] . "\"><b>\\\\1</b></span>', '\\0')", '>' . $message . '<'), 1, -1));

replace
$message = str_replace('\"', '"', substr(@preg_replace_callback(
   '#(\>(((?>([^><]+|(?R)))*)\<))#s',
   function($m){ return @preg_replace("#\b(" . str_replace('\\', '\\\\', addslashes($GLOBALS['highlight_match'])) . ")\b#i", "<span style=\"color:#" . $GLOBALS['theme']['fontcolor3'] . "\"><b>\\1</b></span>", $m[0]); },
   '>' . $message . '<'
), 1, -1));

find
         $user_sig = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $user_sig . '<'), 1, -1));

replace
$user_sig = str_replace('\"', '"', substr(@preg_replace_callback(
   '#(\>(((?>([^><]+|(?R)))*)\<))#s',
   function($m){ return @preg_replace($GLOBALS['orig_word'], $GLOBALS['replacement_word'], $m[0]); },
   '>' . $user_sig . '<'
), 1, -1));

find
      $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));

replace
      $message = str_replace('\"', '"', substr(@preg_replace('#(\>(((?>([^><]+|(?R)))*)\<))#se', "@preg_replace(\$orig_word, \$replacement_word, '\\0')", '>' . $message . '<'), 1, -1));
*/
$message = str_replace('\"', '"', substr(@preg_replace_callback(
   '#(\>(((?>([^><]+|(?R)))*)\<))#s',
   function($m){ return @preg_replace($GLOBALS['orig_word'], $GLOBALS['replacement_word'], $m[0]); },
   '>' . $message . '<'
), 1, -1));

PHP 5.6.x does not respond to Apache encoding, and files with the php extension give the "Content-Type text/html; charset=utf8". At the same time, files with other extensions give away the title of the Apache encoding, which may be different
The simplest solution is to write the necessary encoding in .htaccess
Code:
AddDefaultCharset windows-1251
php_value default_charset windows-1251
Set the encoding separately for Apache, and for php. Instead of windows-1251 write the national encoding

By the way, they could use Apache encoding for htmlspecialchars() and the like. Instead of having fun, adding weird "improvements".
Back to top
hibinyru
Board Member



Joined: 04 May 2020

Posts: 6



PostPosted: Wed May 27, 2020 9:05 am 
Post subject: Re: Upgrade for PHP 7.x

Thank everybody, this topic really help to upgrade phpbb2 to php7

i have problem, please help

code from common.php:

Code:
       if( is_array($HTTP_GET_VARS) )
          {
          while( list($k, $v) = each($HTTP_GET_VARS) )
            {
            if( is_array($HTTP_GET_VARS[$k]) )
              {
              while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
                {
                $HTTP_GET_VARS[$k][$k2] = addslashes($v2);
                }
              @reset($HTTP_GET_VARS[$k]);
              }
            else
              {
              $HTTP_GET_VARS[$k] = addslashes($v);
              }
            }
          @reset($HTTP_GET_VARS);
          }


I see at error.logs:

PHP Warning: addslashes() expects parameter 1 to be string, array given in /var/www/hibinycom/data/httpdocs/forum/common.php on line 131

131 line is $HTTP_GET_VARS[$k][$k2] = addslashes($v2);

how can i repair it?
Back to top
StarWolf3000
Board Member



Joined: 10 Jun 2010

Posts: 151
Location: Germany


flag
PostPosted: Wed May 27, 2020 9:12 am 
Post subject: Re: Upgrade for PHP 7.x

hibinyru wrote:
Thank everybody, this topic really help to upgrade phpbb2 to php7

i have problem, please help

code from common.php:

Code:
       if( is_array($HTTP_GET_VARS) )
          {
          while( list($k, $v) = each($HTTP_GET_VARS) )
            {
            if( is_array($HTTP_GET_VARS[$k]) )
              {
              while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )
                {
                $HTTP_GET_VARS[$k][$k2] = addslashes($v2);
                }
              @reset($HTTP_GET_VARS[$k]);
              }
            else
              {
              $HTTP_GET_VARS[$k] = addslashes($v);
              }
            }
          @reset($HTTP_GET_VARS);
          }


I see at error.logs:

PHP Warning: addslashes() expects parameter 1 to be string, array given in /var/www/hibinycom/data/httpdocs/forum/common.php on line 131

131 line is $HTTP_GET_VARS[$k][$k2] = addslashes($v2);

how can i repair it?


2 things to change:

Replace:
Code:
while( list($k, $v) = each($HTTP_GET_VARS) )

with:
Code:
while( list($v, $k) = each($HTTP_GET_VARS) )

and replace:
Code:
while( list($k2, $v2) = each($HTTP_GET_VARS[$k]) )

with:
Code:
while( list($v2, $k2) = each($HTTP_GET_VARS[$k]) )


In PHP 5, list() begins to assign from the right, while in PHP 7 it assigns from the left. So we have to swap them (see https://www.php.net/list).
Back to top
Vendethiel
Board Member



Joined: 26 Oct 2014

Posts: 188



PostPosted: Wed May 27, 2020 9:50 am 
Post subject: Re: Upgrade for PHP 7.x

Who ever thought this was a good idea? Holy cow.
_________________
Developer on EzArena, the ADR premod.
Developer on Icy Phoenix, the phpBB hybrid cms.
Developer on IntegraMOD, the full-featured premod.
Help me archive premods on github! (fixed for recent PHPs).
Back to top
hibinyru
Board Member



Joined: 04 May 2020

Posts: 6



PostPosted: Wed May 27, 2020 9:53 am 
Post subject: Re: Upgrade for PHP 7.x

Thank you very much! Danke icon_smile.gif

But in *.php files in /forum/ function list(x,y) meets many times.

for exmaple:

/includes/functions.php:
while( list($check_topic_id, $check_post_time) = @each($new_topic_data[$forum_id]) )
while( list($key, $value) = @each($images) )
while ( list($match, $replace) = @each($lang['datetime']) )

/posting.php
while( list($var, $param) = @each($params) )
while( list($option_id, $option_text) = @each($HTTP_POST_VARS['poll_option_text']) )

and more more...

everywere replace it?
Back to top
hibinyru
Board Member



Joined: 04 May 2020

Posts: 6



PostPosted: Wed May 27, 2020 9:55 am 
Post subject: Re: Upgrade for PHP 7.x

Vendethiel wrote:
Who ever thought this was a good idea? Holy cow.

What do you mean?
Back to top
StarWolf3000
Board Member



Joined: 10 Jun 2010

Posts: 151
Location: Germany


flag
PostPosted: Wed May 27, 2020 12:17 pm 
Post subject: Re: Upgrade for PHP 7.x

hibinyru wrote:
everywere replace it?

Yeah, basically you have to do that in each file where this is used.
Back to top
Jim_UK
Board Member



Joined: 19 Nov 2008

Posts: 606
Location: North West UK


flag
PostPosted: Wed May 27, 2020 12:30 pm 
Post subject: Re: Upgrade for PHP 7.x

Vendethiel wrote:
Who ever thought this was a good idea? Holy cow.


Because of
Quote:
In PHP 5, list() begins to assign from the right, while in PHP 7 it assigns from the left. So we have to swap them


Jim

_________________
The truth is out there.
Unfortunately they will not let you anywhere near it!
Back to top
Display posts from previous:   
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Page 6 of 7 All times are GMT
Goto page Previous  1, 2, 3, 4, 5, 6, 7  Next
 
Jump to:  

Index • About • FAQ • Rules • Privacy • Search •  Register •  Login 
Not affiliated with or endorsed by the phpBB Group
Powered by phpBB2 © phpBB Group
Generated in 0.0298 seconds using 15 queries. (SQL 0.0016 Parse 0.0009 Other 0.0273)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo