Stack Overflow is a community of 4.7 million programmers, just like you, helping each other.

Join them; it only takes a minute:

Sign up
Join the Stack Overflow community to:
  1. Ask programming questions
  2. Answer and help your peers
  3. Get recognized for your expertise

I'm using cakephp and php 5.3 and just recently I keep getting this weird error i'm not sure why :

Error: syntax error, unexpected T_STRING, expecting T_FUNCTION File: /Applications/AMPPS/www/gestionstock/server/app/Model/Work.php Line: 2

here is the content of the file Work.php :

<?php 
 class Work extends AppModel{ 
    public $hasOne = array("Projet" , "Salarie" , "Ville") ; 
}
share|improve this question
7  
Are you sure we look at the correct file here? – Rizier123 Apr 28 '15 at 15:34
2  
According to your code and to what you mentioned in your comment - it's seems that it's not related to your code. Maybe your editor's encoding, ftp upload, server's cache? – Ofir Baruch Apr 28 '15 at 15:46
1  
@OfirBaruch I'm trying this on my localhost there is no ftp upload involved in the process , I use sublime text 3 as my editor and I tried these encodings : UTF-8 , UTF-8 without BOM , ISO-8859 1 ans still same error , I'm not sure where to check for server's cache ? – zerzer Apr 28 '15 at 15:54
1  
Did you modify other files recently, perhaps another class file that you forgot to close the bracket for? – sjagr Apr 28 '15 at 15:58
1  
@sjagr I'm getting this on a new cakephp project there isn't much class files and all of them seems to be valid but just this error that keep on some new files – zerzer Apr 28 '15 at 16:03
up vote 0 down vote accepted

It turned out this error was generated because there was a space ' ' after { in line 2;

I'm not sure why this is an error , but removing the space solved my problem.

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.