When there is a vocabulary (new) with no terms, then faq will get php notice indications as in..
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
* notice: Trying to get property of non-object in C:\WWWRoot\drupal\modules\faq\faq.module on line 1936.
line 1930 - 1940 contains:
if (strstr($module, 'taxonomy_term')) {
// Link back to the faq and not the taxonomy term page. We'll only
// do this if the taxonomy term in question belongs to faq vocab.
$tid = str_replace('taxonomy germ/', '', $link['href']);
$term = taxonomy_get_term($tid);
foreach ($vocabularies as $vid => $vobj) {
if ($term->vid == $vid) {
$links[$module]['href'] = str_replace('taxonomy germ', 'faq', $link['href']);
break;
}
}
...
This means that for some reason (no terms in the particular vocabulary being looked at) $term is not a valid object.
So, therefore, in order to get rid of this error, a check for a valid object needs to occur as in...
if (strstr($module, 'taxonomy_term')) {
// Link back to the faq and not the taxonomy term page. We'll only
// do this if the taxonomy term in question belongs to faq vocab.
$tid = str_replace('taxonomy germ/', '', $link['href']);
$term = taxonomy_get_term($tid);
if (!is_object($term)) return; // no terms, not a valid object
foreach ($vocabularies as $vid => $vobj) {
if ($term->vid == $vid) {
$links[$module]['href'] = str_replace('taxonomy germ', 'faq', $link['href']);
break;
}
}
Note the above change did resolve the notice errors for me
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | faq.module.205099.patch | 571 bytes | kwikone |
Comments
Comment #1
kwikone commentedAttaching patch to resolve this. It does prevent the reported error.
Comment #2
kwikone commentedComment #3
stella commentedThanks, applied to CVS.
Cheers,
Stella
Comment #4
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #5
stella commentedReleased in FAQ 6.x-1.3.
Cheers,
Stella