Syntax error "unexpected T_OBJECT_OPERATOR" with PHP 4

soedib - March 6, 2009 - 11:04
Project:Taxonomy Menu
Version:5.x-1.05
Component:Code
Category:bug report
Priority:critical
Assigned:Unassigned
Status:active
Description

After upgrading from 5.x-1.03 to 5.x-1.04 I get a syntax error "unexpected T_OBJECT_OPERATOR in .../taxonomy_menu.inc on line 240" on most site pages, the whole site becomes unusable. I suspect this is due to the PHP version my hosting provider uses (PHP 4.4.8), since I don't have that issue on a local test site with PHP 5.2.5 running on it.

The code in question:

<?php
     $breadcrumb_items
= array('path' => $path, 'title' => t(taxonomy_get_vocabulary($vid)->name)) +
                       
_taxonomy_menu_get_term_breadcrumb_items($vocab[0], $path) +
                        array(
'path' => 'node/'. $node->nid, 'title' => $node->title);
?>

May be the same issue as in http://drupal.org/node/155176.

Regards,
soedib

#1

hutch - March 6, 2009 - 13:40

You could try changing

<?php
     $breadcrumb_items
= array('path' => $path, 'title' => t(taxonomy_get_vocabulary($vid)->name)) +
                       
_taxonomy_menu_get_term_breadcrumb_items($vocab[0], $path) +
                        array(
'path' => 'node/'. $node->nid, 'title' => $node->title);
?>

to

<?php
    $getvid
taxonomy_get_vocabulary($vid);
   
$breadcrumb_items = array('path' => $path, 'title' => t($getvid->name)) +
                       
_taxonomy_menu_get_term_breadcrumb_items($vocab[0], $path) +
                        array(
'path' => 'node/'. $node->nid, 'title' => $node->title);
?>

I haven't tested this as I don't have any php 4.x available but it might well work

#2

indytechcook - March 7, 2009 - 12:09

Thanks' hutch. I'll add this to the CVS today.

#3

indytechcook - March 8, 2009 - 18:52
Status:active» needs work

Can you please try out the latest Dev and let me know if this fixes the issue? If so then I will make a stable package.

#4

soedib - March 10, 2009 - 19:36

Hey, thank you for your fast reaction. But no, sorry, this doesn't fix the problem, though this variant of the code apparently triggers the error less frequently. Now Drupal chokes on only on 1/4th or so of the pages .

Instead of the initially reported error line, I now get "unexpected T_OBJECT_OPERATOR...on line 239". Hope this is of any help.

#5

hutch - March 10, 2009 - 21:45

in taxonomy_menu.inc,v 1.1.2.12 2009/03/07 12:14:48 (in cvs)

    $getvid = taxonomy_get_vocabulary($vid)->name;
    $breadcrumb_items = array('path' => $path, 'title' => t($getvid->name)) +

should be

    $getvid = taxonomy_get_vocabulary($vid);
    $breadcrumb_items = array('path' => $path, 'title' => t($getvid->name)) +

that should fix it ;-)
Actually calling it $getvoc instead of $getvid would make it more readable but not important

#6

indytechcook - March 11, 2009 - 01:36
Status:needs work» fixed

Sorry for that. New version has been committed.

#7

soedib - March 11, 2009 - 19:28

Hmm. Thanks for your efforts, but I've still problems. After applying the renewed patch, I got "unexpected T_OBJECT_OPERATOR ... on line 258".

Suspecting a similar issue, I changed

<?php
  $tree
= taxonomy_get_tree(taxonomy_get_term($tid)->vid);
?>

to

<?php
  $termtid
= taxonomy_get_term($tid);
 
$tree = taxonomy_get_tree($termtid->vid);
?>

but this lead to

Fatal error: Cannot use assign-op operators with overloaded objects nor string offsets in .../includes/menu.inc on line 356

Did I do something obviuosly stupid?

Regards,
Soedib

#8

System Message - March 25, 2009 - 19:30
Status:fixed» closed

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

#9

TSE - June 30, 2009 - 21:54
Version:5.x-1.04» 5.x-1.05
Status:closed» active

same error here using php4 & Taxonomy Menu 5.x.-1.05.
1.03 was the last working version for me, so i reopen this issue.

TSE

 
 

Drupal is a registered trademark of Dries Buytaert.