MyBB Community Forums
Plugin Changes coming in 1.6.5 - Printable Version

+- MyBB Community Forums (https://community.mybb.com)
+-- Forum: Community Archive (https://community.mybb.com/forum-106.html)
+--- Forum: Archived Forums (https://community.mybb.com/forum-143.html)
+---- Forum: Archived Development and Support (https://community.mybb.com/forum-155.html)
+----- Forum: MyBB 1.6 (https://community.mybb.com/forum-138.html)
+------ Forum: 1.6 General Support (https://community.mybb.com/forum-127.html)
+------ Thread: Plugin Changes coming in 1.6.5 (/thread-106729.html)

Pages: 1 2 3 4 5 6 7


RE: Plugin Changes coming in 1.6.5 - pavemen - 2011-10-28

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;



RE: Plugin Changes coming in 1.6.5 - Dylan M. - 2011-10-28

(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.


RE: Plugin Changes coming in 1.6.5 - pavemen - 2011-10-28

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


RE: Plugin Changes coming in 1.6.5 - Tomm M - 2011-10-28

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.


RE: Plugin Changes coming in 1.6.5 - Euan T - 2011-10-28

(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.


RE: Plugin Changes coming in 1.6.5 - pavemen - 2011-10-28

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


RE: Plugin Changes coming in 1.6.5 - Dylan M. - 2011-10-28

(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


RE: Plugin Changes coming in 1.6.5 - Dylan M. - 2011-10-28

(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


RE: Plugin Changes coming in 1.6.5 - Hay_Den - 2011-10-28

(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!


RE: Plugin Changes coming in 1.6.5 - pavemen - 2011-10-28

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