When activating taxonomy context module and trying to browse into a vocabulary page the page gets empty
Looking at my PHP logs I found the following errors:
PHP Fatal error: Only variables can be passed by reference in ..\modules\\taxonomy_context\taxonomy_context.module on line 269
PHP Fatal error: Only variables can be passed by reference in ..\modules\\taxonomy_context\taxonomy_context.module on line 284
case 'term':
$tidcurrs = preg_split('/[+ ,]/', arg(2));
$context['tid'] = $tidcurrs[0];
X --> $top_parent = array_pop(taxonomy_get_parents_all($context['tid']));
$context['root_tid'] = $top_parent->tid;
$term = taxonomy_get_term($context['tid']);
$context['vid'] = $term->vid;
break;
}
break;
case 'node':
if (arg(2) == null) {
$context['nid'] = arg(1);
$tidscurr = taxonomy_node_get_terms(arg(1));
foreach ($tidscurr as $tidcurr) {
$context['tid'] = $tidcurr->tid;
break;
}
X --> $top_parent = array_pop(taxonomy_get_parents_all($context['tid']));
$context['root_tid'] = $top_parent->tid;
$term = taxonomy_get_term($context['tid']);
$context['vid'] = $term->vid;
}
Replacing the problematic lines with the following code solved the problem..
//$top_parent = array_pop(taxonomy_get_parents_all($context['tid']));
$temp = array();
$temp = taxonomy_get_parents_all($context['tid']);
$top_parent = array_pop($temp);
Hope this helps someone...
Comments
Comment #1
deekayen commentedI wasn't able to reproduce this, but it seems like a harmless patch. If nothing else, it increases code readability. Proper patch attached.
Comment #2
lee20 commented@Optaglin
I'd be interested to know what PHP Version you were running to see this error and what your error level was set to. It seems odd that this wasn't seen before.
@deekayen
Thanks for the patch!
An alternative syntax would have been to use list(). This eliminates the need for allocating a temp variable, but the difference is trivial.
Comment #3
lee20 commentedComment #4
Leeteq commentedWhere is this patch implemented?
(The dev. version is from Jan. 15th, is that the one? The last patch in this thread is at a later date.)
Comment #5
lee20 commented@DanielTheViking
Thanks for pointing that out. I had committed the patch to HEAD but not to the 5 branch. Therefore the change did not appear in the dev release as it is a nightly snapshot. This should be resolved once the next snapshot is taken.
Comment #6
Anonymous (not verified) commentedAutomatically closed -- issue fixed for two weeks with no activity.
Comment #7
optalgin commentedSorry, I upgraded PHP few times since my post :-)
If I remember right, it was PHP5 but I'm not sure the exact version...
Anyway if I ever post again I'll try to add all the information
Thanks for your comments