When I enable both Help injection and Help injection help I get this on front page:
warning: mysqli_real_escape_string() expects parameter 2 to be string, object given in X:\home\www.example.com\www\includes\database.mysqli.inc on line 323
warning: mysqli_real_escape_string() expects parameter 2 to be string, object given in X:\home\www.example.com\www\includes\database.mysqli.inc on line 323

CommentFileSizeAuthor
#3 helpinject-6.x-1.0-alpha5-458796-1.patch824 bytesbrahms

Comments

brahms’s picture

I have the same error messages. They come from line 654 in the file helpinject.module in function helpinject_help_link:

if (isset($element['#type']) && !in_array($element['#type'], array('button', 'image_button', 'submit', 'markup', 'token', 'hidden', 'form', 'value', 'weight'))) {

In my problem case $element is a string "node" and $form_id is the node object. In this case I would expect that isset($element['#type']) will return FALSE because $element is not an array and therefore the array key '#type' doesn't exist. I don't know why, but PHP returns TRUE for isset($element['#type']) instead (and "n" for $element['#type']) and so the IF condition is evaluated to TRUE and in the next line the function helpinject_get_from_key is called with the node object as parameter $form_id which leads to the error message later. It really seems to be an error in the isset function in PHP, I use PHP 5.1.6 under Red Hat Enterprise Linux 5.

To prevent these errors I added is_array($element) to the IF clause, the modified line 654 in the file helpinject.module is now:

if (is_array($element) && isset($element['#type']) && !in_array($element['#type'], array('button', 'image_button', 'submit', 'markup', 'token', 'hidden', 'form', 'value', 'weight'))) {

I attach a patch file for fixing the error

robertdouglass’s picture

Nice analysis brahms. Is the patch still coming?

brahms’s picture

StatusFileSize
new824 bytes

Sorry Robert, here is the patch file.

robertdouglass’s picture

Status: Active » Fixed

Committed, thanks.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.