Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

unexpected T_OBJECT_OPERATOR

Status
Not open for further replies.

jemminger

Programmer
Jun 25, 2001
3,453
US
using php 4.4.1 on linux, i get the error

Parse error: parse error, unexpected T_OBJECT_OPERATOR

at the highlighted line:
Code:
	if (hasWorkflow()) {
		[highlight]$wf = getWorkflow();[/highlight]
		$wf -> delete();
	}

any idea why? it works fine locally on php 5, and i don't think i'm using any php 5-specific syntax.




-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
It appears to me that the assignment of the result of the function is not an object. PHP 4 requires object initialization with a class, preceded by the 'new' keyword.
I haven't done this in PHP5, so no comments on that.

Since $wf is not an object the -> (arrow) operator which signifies accessing a method or member of an object (that is an instatnce of a class) triggers the error.
 
hmm... the function getWorkflow() does return an object:
Code:
	function getWorkflow() {
		if (isset($_SESSION["workflow"])) {
			return $_SESSION["workflow"];
		}
		else {
			return null;
		}
	}//  end getWorkflow()

what's more odd is that this same syntax work fine on another page on the same server... the particular spot where the offending code is above is a point where it would redirect to another step after performing the delete() method... if i manually type in the next step URL it works, and the next step is using the very same syntax! boggles the mind. we'll probably just upgrade our production server to php5 and forget the whole mess (i hope)

-jeff
try { succeed(); } catch(E) { tryAgain(); } finally { rtfm(); }
i like your sleeves...they're real big
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top