Adding phpbb prefix to functions

Note: We are moving the topics of this forum and it will be deleted at some point

Publish your own request for comments/change or patches for the next version of phpBB. Discuss the contributions and proposals of others. Upcoming releases are 3.2/Rhea and 3.3.
Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: Adding phpbb prefix to functions

Post by Oleg »

Let's try to restrict the scope of this RFC.

If parameter list of a function is changed, do you support adding phpbb prefix to its name at the same time?

User avatar
imkingdavid
Registered User
Posts: 1050
Joined: Thu Jul 30, 2009 12:06 pm

Re: Adding phpbb prefix to functions

Post by imkingdavid »

Oleg wrote:Let's try to restrict the scope of this RFC.

If parameter list of a function is changed, do you support adding phpbb prefix to its name at the same time?
Only new functions should get a phpbb_ prefix, imo. Basically, any time you'd have to go through existing code and change the function calls, I would vote against it. Functions added in new PRs need the prefix, though.
I do custom MODs. PM for a quote!
View My: MODs | Portfolio
Please do NOT contact for support via PM or email.
Remember, the enemy's gate is down.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: Adding phpbb prefix to functions

Post by Oleg »

You have to change call sites anyway because of changed parameter list?

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: Adding phpbb prefix to functions

Post by MichaelC »

EXreaction wrote:At the least, wrappers should be put in a separate file so they can be cleaned up in the future and managed by the board administrator if they must deal with a specific collision incident and should not be wrapped in if (!function_exists()).
I see your point thinking about it, the original aim was probably to remove them in future but even then it will still break BC, just less BC. However if we did implement wrapper then +1 to the above quote.
Oleg wrote:If parameter list of a function is changed, do you support adding phpbb prefix to its name at the same time?
Unless it is added to the end & is optional (therefore doesn't break BC) I'd +1 to changing it as the calls & BC are being changed/broken (respectively) anyway.
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: Adding phpbb prefix to functions

Post by EXreaction »

Oleg wrote:Let's try to restrict the scope of this RFC.

If parameter list of a function is changed, do you support adding phpbb prefix to its name at the same time?
I believe that changing the parameter list should be prevented unless absolutely necessary as well.

If it is necessary to change the parameter list and the inputs are not optional, then the BC has been broken, so changing the function name is not an issue (though if it is not just prefixed and the function name is changed I'd like to see a comment on the function including the old name).

As per my previous comment, if we create a file to contain wrapper functions and depreciate the old function names over a few major versions, I would not have a problem with renaming the functions because extension authors would have a while to update and board owners could manage any compatibility issues on their own (in the case of conflicts, remove the wrappers and deal with any old calls to the function; in the case of older code that was written, keep the wrappers beyond the time when they are depreciated and removed).

User avatar
MichaelC
Development Team
Development Team
Posts: 889
Joined: Thu Jan 28, 2010 6:29 pm

Re: Adding phpbb prefix to functions

Post by MichaelC »

EXreaction wrote:
Oleg wrote:Let's try to restrict the scope of this RFC.

If parameter list of a function is changed, do you support adding phpbb prefix to its name at the same time?
I believe that changing the parameter list should be prevented unless absolutely necessary as well.

If it is necessary to change the parameter list and the inputs are not optional, then the BC has been broken, so changing the function name is not an issue (though if it is not just prefixed and the function name is changed I'd like to see a comment on the function including the old name).
It is quite important in automated testing. 3.1 contains BC breaks, there is nothing that says it can't, we just avoid them as much as possible. This will probably change for x.y releases so that only x releases get BC breaks after 3.1 but for 3.1 I think we can accept there may be some small BC breaks.
Formerly known as Unknown Bliss
psoTFX wrote: I went with Olympus because as I said to the teams ... "It's been one hell of a hill to climb"
No unsolicited PMs please except for quotes.

User avatar
EXreaction
Registered User
Posts: 1555
Joined: Sat Sep 10, 2005 2:15 am

Re: Adding phpbb prefix to functions

Post by EXreaction »

What is quite important in automated testing?

User avatar
DionDesigns
Registered User
Posts: 51
Joined: Sat Apr 21, 2012 4:29 am
Location: Uncertain due to momentum
Contact:

Re: Adding phpbb prefix to functions

Post by DionDesigns »

EXreaction wrote:Unless there is a specific incident with naming collision with other popular software, I do not support renaming existing functions.
FYI: http://www.jfusion.org/forums/viewtopic.php?t=6795

User avatar
brunoais
Registered User
Posts: 964
Joined: Fri Dec 18, 2009 3:55 pm

Re: Adding phpbb prefix to functions

Post by brunoais »

For me, we should change all functions to use the phpbb_ prefix.
With that for the next one or two subversions, we would still support the non prefixed function.

This is made in a very simple way. Just cut and paste the code from the non phpbb_ prefixed function into the phpbb_ prefixed function. Just write the code needed to call the function with the same name but with the phpbb_ prefix. Something like this:

Code: Select all

phpbb_function_name($param1, $param2)
{
	// useful code
}
function_name($param1, $param2)
{
	return phpbb_function_name($param1, $param2);
}
With this we keep the backwards compatibility for the MOD authors (and forgotten code) at the expense of a minor performance hit while loading the files and while the functions are used this way.

Oleg
Posts: 1150
Joined: Tue Feb 23, 2010 2:38 am
Contact:

Re: Adding phpbb prefix to functions

Post by Oleg »

We are not going to be changing all functions. This involves too much work and will break everything because we don't have 100% test coverage, not to mention political unrest.

Can we keep on topic please? The case we are discussing changes required parameters which necessitates all call sites to be edited regardless of whether prefix is added or not.

Post Reply