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
 
Search this topic... | Search phpBB2 Discussion... | Search Box
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Author Message
clausl
Board Member



Joined: 27 May 2019

Posts: 12



PostPosted: Wed May 29, 2019 7:18 pm 
Post subject: Re: Upgrade for PHP 7.x

Okay this is paradox. If I just leave the totally empty function in the file, execution breaks

Code:
function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, &$cur_password, &$password_confirm, &$icq, &$aim, &$msn, &$yim, &$website, &$location, &$occupation, &$interests, &$signature, &$viewemail, &$notifypm, &$popup_pm, &$notifyreply, &$attachsig, &$allowhtml, &$allowbbcode, &$allowsmilies, &$hideonline, &$style, &$language, &$timezone, &$dateformat, &$session_id)
{
   
}


If I take that part out registration runs through

That got me thinking if any of the names for the variables is a reserved word in PHP7

Seems like the right path. When I used

Code:
function display_avatar_gallery($mode, &$d2, &$d3, &$d4, &$d5, &$d6, &$d7, &$d8, &$d9, &$d10, &$d11, &$d12, &$d13, &$d14, &$d15, &$d16, &$d17, &$d18, &$d19, &$d20, &$d21, &$d22, &$d23, &$d24, &$d25, &$d26, &$d27, &$d28, &$d29, &$d30, &$d40, &$d41, &$d42, &$d43)
{

   
}

?>


instead, it runs again.
Now big question, which of the 43 candidates is a reserved word in PHP7

FOUND IT:

Quote:
function display_avatar_gallery($mode, &$category, &$user_id, &$email, &$current_email, &$coppa, &$username, &$email, &$new_password, ...


The parameter &$email is used TWICE in the function. I have no idea why this is valid in PHP5.6? Is this a genuine programming error in the initial version or is there any sense to that.
If I rename one of them to §&email2 it runs through
Back to top
clausl
Board Member



Joined: 27 May 2019

Posts: 12



PostPosted: Thu May 30, 2019 9:58 am 
Post subject: Re: Upgrade for PHP 7.x

Thanks for the help! I switched to PHP 7.3 now for the live version of the board. Should I still encounter any issues, I'll post them here for the information of others.
Back to top
clausl
Board Member



Joined: 27 May 2019

Posts: 12



PostPosted: Tue Jun 04, 2019 9:14 pm 
Post subject: Re: Upgrade for PHP 7.x

After the first few days, I can report it is running fine without any issues.
According to Search console the average loading time for pages has been reduced by about 25%.
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 672
Location: Texas


flag
PostPosted: Wed Jun 05, 2019 9:25 pm 
Post subject: Re: Upgrade for PHP 7.x

clausl wrote:
According to Search console the average loading time for pages has been reduced by about 25%.

Always a good thing to see performance improvements! Thanks for the update.

_________________
phpBBDoctor Blog
Back to top
Salvatos
Board Member



Joined: 19 Feb 2009

Posts: 436
Location: Québec


flag
PostPosted: Thu Jun 06, 2019 2:53 am 
Post subject: Re: Upgrade for PHP 7.x

Looks like I missed a couple posts here. Good to hear you have it figured out.

clausl wrote:
The parameter &$email is used TWICE in the function. I have no idea why this is valid in PHP5.6? Is this a genuine programming error in the initial version or is there any sense to that.

I'm not a pro, but I can't see a reason why you would want to include the same variable twice in a function call. Interesting catch!
Back to top
StarWolf3000
Board Member



Joined: 10 Jun 2010

Posts: 114
Location: Germany


flag
PostPosted: Thu Jun 06, 2019 6:20 am 
Post subject: Re: Upgrade for PHP 7.x

Salvatos wrote:
Looks like I missed a couple posts here. Good to hear you have it figured out.

clausl wrote:
The parameter &$email is used TWICE in the function. I have no idea why this is valid in PHP5.6? Is this a genuine programming error in the initial version or is there any sense to that.

I'm not a pro, but I can't see a reason why you would want to include the same variable twice in a function call. Interesting catch!

Looks like this nonsensical "typo" dates back to the beginnings of phpBB2 and no one, not even the devs, were aware of it.
Back to top
drathbun
Board Member



Joined: 24 Jul 2008

Posts: 672
Location: Texas


flag
PostPosted: Sat Jun 08, 2019 1:03 pm 
Post subject: Re: Upgrade for PHP 7.x

I can confirm that the same issue (double pass of email parameter) exists even in my highly modified phpBB code base, which dates back quite a few years. Weird that the current version of PHP doesn't like it. It's not appropriate or useful, strictly speaking, but I can't see that it's a problem unless the calling function overloads the destination variable. That's probably why it's being checked now.

For example this:
Code:
$some_function_result = my_broken_function($a, $b)

calling this
Code:
function my_broken_function($a, $a)

...would clearly be a problem, as the second instance of $a in the parameter list would be overwritten by the second argument. In this case, both instances of the $email function argument are being passed the exact same thing, so functionally (ha, pun) it works. From a syntax perspective it's dangerous, and I am glad they are catching it now.

Thanks for sharing. After all these years, still learning something new!

_________________
phpBBDoctor Blog
Back to top
Display posts from previous:   
Register or Login to Post    Index » phpBB2 Discussion  Previous TopicPrint TopicNext Topic
Page 3 of 3 All times are GMT
Goto page Previous  1, 2, 3
 
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.0252 seconds using 15 queries. (SQL 0.0017 Parse 0.0008 Other 0.0226)
phpBB Customizations by the phpBBDoctor.com
Template Design by DeLFlo and MomentsOfLight.com Moments of Light Logo