1
votes

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") ; 
}
1
Are you sure we look at the correct file here?Rizier123
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
@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
Did you modify other files recently, perhaps another class file that you forgot to close the bracket for?sjagr
@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 fileszerzer

1 Answers

0
votes

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.