| Project: | Advanced Help Injection and Export |
| Version: | 6.x-1.0-alpha6 |
| Component: | Code |
| Category: | bug report |
| Priority: | normal |
| Assigned: | Unassigned |
| Status: | active |
| Issue tags: | help inject, urlencode |
Issue Summary
Just wanted to start by saying that your module is really awesome and useful thanks for developing it.
After starting to use your module I was receiving the following errors:
warning: rawurlencode() expects parameter 1 to be string, object given in //includes/common.inc on line 2514.
I tracked the issue down to the following:
<?php
function _helpinject_admin_link($type, $key, $name, $class = '') {
global $base_path;
if (user_access('inject help')) {
drupal_add_css(drupal_get_path('module', 'helpinject') . '/helpinject.css');
$_class = 'helpinject-link';
if (!empty($class)) {
$_class .= " $class";
}
$text = '<span>' . t('Inject help') . '</span>';
return l($text, "helpinject/inject/$type/" . drupal_urlencode($key), array(
'attributes' => array(
'class' => $_class,
'title' => t('Inject some help text here (%type, %value).', array('%type' => t($type), '%value' => $name)),
),
'query' => 'destination=' . $_GET['q'],
'html' => TRUE,
)
);
}
}
?>In my case the $key value sometimes comes in as an array which is a no-go with urlencode. So to repair the issue I added the following to the top... I'm sure this limits some of the areas that can be used properly
<?php
function _helpinject_admin_link($type, $key, $name, $class = '') {
global $base_path;
// [SB]: Changed to exclude any keys that were objects
if (user_access('inject help')) && is_string($key)) {
?>I couldn't quite figure out what class id you are referencing to place your inject help buttons or else I would have provide a better fix sorry. Btw it seems like when a $key comes in that isn't a string it is usually a block of sorts.