Posted by crea on May 10, 2009 at 4:59pm
4 followers
| Project: | Advanced Help Injection and Export |
| Version: | 6.x-1.0-alpha5 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | closed (fixed) |
Issue Summary
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
Comments
#1
I have the same error messages. They come from line 654 in the file helpinject.module in function helpinject_help_link:
<?phpif (isset($element['#type']) && !in_array($element['#type'], array('button', 'image_button', 'submit', 'markup', 'token', 'hidden', 'form', 'value', 'weight'))) {
?>
In my problem case
$elementis a string "node" and$form_idis the node object. In this case I would expect thatisset($element['#type'])will return FALSE because$elementis not an array and therefore the array key '#type' doesn't exist. I don't know why, but PHP returns TRUE forisset($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_idwhich 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:<?phpif (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
#2
Nice analysis brahms. Is the patch still coming?
#3
Sorry Robert, here is the patch file.
#4
Committed, thanks.
#5
Automatically closed -- issue fixed for 2 weeks with no activity.