When i enable the module Search API Solr, documentation provide by the module help is broken.
I get the following error.

"Recoverable fatal error : Argument 2 passed to search_api_solr_help() must be an array, null given in search_api_solr_help() (ligne 95 dans /sites/all/modules/search_api_solr/search_api_solr.module)."

To avoid this error, i changed

function search_api_solr_help($path, array $arg = array())

to

function search_api_solr_help($path, $arg = array())

in search_api_solr.module, line 95.

Regards,

herve.

CommentFileSizeAuthor
#1 search_api_solr-help.patch631 bytesherve

Comments

herve’s picture

StatusFileSize
new631 bytes

A tiny patch attached to this post.

mgifford’s picture

Priority: Normal » Critical
Status: Active » Reviewed & tested by the community

This messes up other help modules. It's tiny, but it breaks other help pages so I'm moving this up to critical.

drunken monkey’s picture

Which module calls this function with NULL as a second parameter?

From the hook_help() documentation:

$arg:
An array that corresponds to the return value of the arg() function, for
modules that want to provide help that is specific to certain values
of wildcards in $path. For example, you could provide help for the path
'user/1' by looking for the path 'user/%' and $arg[1] == '1'. This given
array should always be used rather than directly invoking arg(), because
your hook implementation may be called for other purposes besides building
the current page's help. Note that depending on which module is invoking
hook_help, $arg may contain only empty strings. Regardless, $arg[0] to
$arg[11] will always be set.

So I'm pretty sure that the caller is in the wrong here, not this module. I'm just taking the coding standards more seriously than others (including parts of core).

drunken monkey’s picture

Status: Reviewed & tested by the community » Closed (won't fix)
jgalletta’s picture

Rubik theme is one of the culprits, I submitted an issue and a patch: http://drupal.org/node/1996474

fluxsauce’s picture

Title: Mistake on hook_help implementation » Mistake on hook_help implementation causes fatal errors
Version: 7.x-1.0-rc1 » 7.x-1.1
Status: Closed (won't fix) » Reviewed & tested by the community

I just encountered this bug. Yes, it's now fixed in rubik #1996474: module_invoke for hook help is generating a fatal error for some modules (not in the full release), but for anyone who isn't using that beta release that came out a week ago (which is most people) will still encounter this avoidable fatal error. The official API documentation which you linked to reads:

function hook_help($path, $arg) {

You're not wrong about $arg containing arrays, but some points aren't worth making. Your implementation deviates from the official API and it's causing avoidable problems.

Please reconsider.

drunken monkey’s picture

Status: Reviewed & tested by the community » Closed (won't fix)

Now it makes less sense than ever. It is actually fixed in Rubik and there's a new release, so either people can just update Rubik – or we can commit this workaround, people can wait for our next release and then update this module instead of Rubik. Why would this have any advantage?
I agree my position is disputable, but I just think it's important to adhere to the coding standards, and I don't like to compromise there just because of errors in other modules. (That's also why I hate working with Views.)

For fixing fatal errors, especially since it apparently took over a year to solve them otherwise, it might have been the better option (even though it would have meant that the Rubik error probably wouldn't have been fixed at all), but it doesn't really make any sense anymore, as explained above.

kenorb’s picture

Upgrade of Rubik helped. Thanks.