fatal error on filter_user_has_cap() call
-
I ran into a bug tonight with this plugin while using another plugin, New Blog Templates by WPMU Dev. Their plugin has an option to block editing of posts/pages created with a template which causes the user_has_cap filter used by this plugin to pass a boolean (presumably false) instead of an array as the first parameter of the filter. Since the parameters are strongly typed in this plugin, it throws a fatal error.
I’d say this is more of a bug in core or at least in the ‘user_has_cap’ filter documentation, since it says that the it’s always supposed to pass an array. Either way, I managed to fix the issue by removing the array type-casting for $user_caps on line 497 in this plugin and doing a test to ensure it’s an array before attempting to modify it – if it’s not an array, I’m just returning it and it seems to work fine.
- The topic ‘fatal error on filter_user_has_cap() call’ is closed to new replies.