Error thrown:
preg_match() expects parameter 2 to be string, array given in //includes/bootstrap.inc on line 777.
Offending File:
/sites/all/modules/ctools/page_manager/plugins/tasks/search.inc
Offending Line:
212: 'admin description' => t('Search @type', array('@type' => $type)),
This is an invalid call to t(
) (common.inc) and it is the root cause of the error during the FTP download function of the plugin_manager.
Modifying the call to read:
212: 'admin description' => array(t('Search @type'), array('@type' => $type)),
Seems to correct the problem.
I need the author to review this because I believe that it doesn't cover the intended t() check of the second array parameter.
Comments
Comment #1
merlinofchaos commentedYou are incorrect. That is a valid use of the t() call unless, somehow, $type is somehow not a string. Your change is not correct, as the array as the second argument to t() is how placeholders are filled in fro translation.
Comment #2
RaRi commentedsubscribe
Comment #3
sjz commentedGreat! - So I'm not correct ... Yet the problem remains resolved with the manual change implemented on 3 sites.
The fact remains that it is still throwing the error ... any insights there? It's being thrown specifically because of the trace I've provided.
Instead of closing - perhaps you might ask for more diagnostic information? something that might have led me to the fact that this, indeed, is the start of the fault? what else might you need?
Comment #4
sjz commentedComment #5
merlinofchaos commentedAs I said, unless $type is somehow not a string -- you should do some investigation of what $type is at that point.
Comment #6
sjz commentedWhat is $type supposed to contain following the call to module_invoke?
Line 207:
$type = module_invoke($name, 'search', 'name', TRUE);I modified the module to dump the variables to watchdog. On one of my configurations exhibiting the problem, it is being called 5 times with the first 4 results showing
$type result:
As you see here - the values of $type are, indeed, string values.
However - the final call results in $type containing an array value of about 14K characters starting with
(Note the
array:9result returned frommodule_invoke)that 14K segment ends with
I can provide the whole array but I'm not familiar enough with your code to do much more diagnosis beyond this. If the problem is, indeed with the
module_invokefunctionality - I'll have to dig more but I'm not sure what that call is intended to return.Moreover, I don't do much drupal coding. It would be helpful and appreciated to get some debugging hints from those of you who DO ...
Comment #7
merlinofchaos commentedmodule_invoke calls a hook from a specific module. This indicates that a module is improperly implementing hook_search and I think you are now very close to finding your bug.
What $module was it invoking when it got the clearly wrong return?
Comment #8
merlinofchaos commentedEr I guess $name, not $module
Comment #9
sjz commentedThis is the formatted parameter list from backtrace:
Therefore - it appears that
plugin_manageris the culprit. Theplugin_managersearch function appears to be onLine 572:
function plugin_manager_search()Following your clue, and combining it with the other functions which seem to present "Search," this is what grep shows for advanced help and plugin_manager from the modules directory:
grep -r "function.*_search\("
Therefore it appears that the issue is with the plugin_manager's implementation of search. I will re-queue this to the
plugin_manageras a bug...Thank you for the hints...
Comment #10
blakbro2k6 commentedanyone walked through a fresh instance of Drupal and see if it throws this from the start?
Comment #11
tinubuntu commentedI have the same problem ... now ... after some upgrades...
Comment #12
Anonymous (not verified) commentedIt looks like there is a conflict in naming. Plugin_manager_search is not supposed to be an instance of hook_search. It should probably have another name, such as plugin_manager_find or something. I'm a little short on time over the next few days, but if someone wants to try it out and post a patch, I can commit it.
Comment #13
jdwfly commentedMarked #694784: Warning: preg_match() in bootstrap.inc when running plugin as duplicate
Comment #14
webindustries commentedanyone solved this issue?
Comment #15
alfthecat commentedsubscribing
Comment #16
blakbro2k6 commentedI made a quick attempt at the suggestion by JoshuaRogers, he appears to be spot on. I only have done some preliminary testing if anyone else wishes to test this patch?
Comment #18
blakbro2k6 commentedapologies, MS-DOS characters cleaned.
Comment #19
PacmanZ commentedI missed that report at first and came to the same diagnostic.
#18 works for me, thank you blakbro2k6.
Comment #20
Anonymous (not verified) commentedCommitted. Thanks for all the work.