[wp-hackers] Plugins 'all' tag discussion

Jacob wordpress at santosj.name
Sun Oct 21 07:36:13 GMT 2007


 From php.net http://www.php.net/array_merge:

"If, however, the arrays contain numeric keys, the later value will 
*not* overwrite the original value, but will be appended.

If only one array is given and the array is numerically indexed, the 
keys get reindexed in a continuous way."

This translate to: If you use array_merge to merge two arrays the result 
will be reindexed. The documentation is wrong, it doesn't matter how 
many arrays you give, they will all still be reindexed. I found this out 
while writing unit tests for plugin.php and trying to remove the hook 
afterwards.

Resulting in the lost of hook priorities. See 
http://trac.wordpress.org/ticket/4715. The fix this is to use '+' to add 
the two arrays. This has been confirmed to be the fix (by my unit test) 
and has been confirmed to be broken in by two separate parties (my unit 
test and Automattic unit tests).

If the 'all' tag is to be of any use, it will need to be first *fixed* 
and then extended for the other enhancements.

http://trac.wordpress.org/ticket/5231
http://trac.wordpress.org/ticket/5232

I've been thinking about the solution to 5231 and there isn't really a 
good one unless you create two globals, one for filters and one for 
actions. Which isn't a good solution, but one that would require the 
least amount of resistance.

Fixing 5232 solution is already available and I would suggest a 
combination of the two proposed "patches."

Any more thoughts on how to go about correcting this misbehavior?

Jacob Santos



More information about the wp-hackers mailing list