MyBB Community Forums

Full Version: Plugin Changes coming in 1.6.5
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2 3 4 5 6 7
so we need to go from:

$plugins->add_hook("some hook name that is passed byref", "myplugin_for_the_hook");

function myplugin_for_the_hook($var_from_hook)


to

$plugins->add_hook("some hook name that is passed byval", "myplugin_for_the_hook");

function myplugin_for_the_hook(&$var_from_hook)


basically adding the "&" and we are all set?

<edit> the above if for the second set of hooks in the list, but the first set of hooks need this added to them?

return $var_passed_from_hook;
(2011-10-28, 03:59 AM)pavemen Wrote: [ -> ]so we need to go from:

$plugins->add_hook("some hook name that is passed byref", "myplugin_for_the_hook");

function myplugin_for_the_hook($var_from_hook)


to

$plugins->add_hook("some hook name that is passed byval", "myplugin_for_the_hook");

function myplugin_for_the_hook(&$var_from_hook)


basically adding the "&" and we are all set?

For the ones in the second section of the wiki. In the first section you'll need to actually return the values.
Here is a quick script that I put together that will check all your PHP file in the current folder for the hooks listed in the Wiki

Just upload it to the folder you want to check, usually just /inc/plugins and then open it in your browser.

Snapshot of example output below. For each PHP file, it looks for the hook name listed and outputs the type of issue (Return code or Reference Check), hook name and the function being called for that hook.

This should help authors find things they need to check/update and users to know what plugins they need to look for updated versions or to correct themselves.

http://community.mybb.com/thread-108595.html
Plugins affected by this will simply not 'work'. To fix it, you only need simple file changes to the function names - there is no need to deactivate/uninstall anything.
(2011-10-28, 06:40 AM)pavemen Wrote: [ -> ]Here is a quick script that I put together that will check all your PHP file in the current folder for the hooks listed in the Wiki

Just upload it to the folder you want to check, usually just /inc/plugins and then open it in your browser.

Snapshot of example output below. For each PHP file, it looks for the hook name listed and outputs the type of issue (Return code or Reference Check), hook name and the function being called for that hook.

This should help authors find things they need to check/update and users to know what plugins they need to look for updated versions or to correct themselves.

So useful, thanks pavemen! I'm going to be performing the required updates later on today/tomorrow and this is definitely a help.
there should be a way to fast-track plugins that are updated for this issue as I can see the queue for validation getting very long and a decent delay in approval
(2011-10-28, 02:23 PM)pavemen Wrote: [ -> ]there should be a way to fast-track plugins that are updated for this issue as I can see the queue for validation getting very long and a decent delay in approval

I'll probably be handling that. I'd hope to get everything that is affected by this issue updated by the time 1.6.5 is ready for public release. Smile
(2011-10-28, 06:40 AM)pavemen Wrote: [ -> ]Here is a quick script that I put together that will check all your PHP file in the current folder for the hooks listed in the Wiki

Just upload it to the folder you want to check, usually just /inc/plugins and then open it in your browser.

Snapshot of example output below. For each PHP file, it looks for the hook name listed and outputs the type of issue (Return code or Reference Check), hook name and the function being called for that hook.

This should help authors find things they need to check/update and users to know what plugins they need to look for updated versions or to correct themselves.

Thats awesome, thanks pavemen Smile

(2011-10-28, 07:45 AM)Tomm M Wrote: [ -> ]Plugins affected by this will simply not 'work'. To fix it, you only need simple file changes to the function names - there is no need to deactivate/uninstall anything.

Not entirely true... the ones that now require a "return" value will nuke whatever variable is assigned to them if it isn't returned. This could lead to a lot of complaints Wink
(2011-10-28, 06:40 AM)pavemen Wrote: [ -> ]Here is a quick script that I put together that will check all your PHP file in the current folder for the hooks listed in the Wiki

Just upload it to the folder you want to check, usually just /inc/plugins and then open it in your browser.

Snapshot of example output below. For each PHP file, it looks for the hook name listed and outputs the type of issue (Return code or Reference Check), hook name and the function being called for that hook.

This should help authors find things they need to check/update and users to know what plugins they need to look for updated versions or to correct themselves.



So, we will replaced Hook Name by Function Called values? or what ?
Thanks!
no, you need to find the function listed and correct it as needed. the "reference check" needs an "&" before the variable

function myfunction($var)

becomes

function myfunction(&$var)

for the return code you need to find the variable being passed and add as the last line of the function (usually)

return $var
Pages: 1 2 3 4 5 6 7