Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

unexpected 'class' (T_CLASS) only on remote (not in local) [duplicate]

Tags:

oop

php

We are developping a CRM.

In local, I have no problem, but in remote (OVH), I have this error message :

Parse error: syntax error, unexpected 'class' (T_CLASS), expecting identifier (T_STRING) or variable (T_VARIABLE) or '{' or '$' in /home/dubinfo/www/CRM/model/Locataire.php on line 126

This is the code :

public function setVisites($visites) {
    $this->_visites = CheckTyper::isArrayOfModel($visites,
            VisiteMaisonInvestisseur::class, 'visites', __CLASS__);
}

The version of PHP on remote host (OVH) is 5.4.38

like image 562
user3553866 Avatar asked Apr 25 '15 07:04

user3553866


People also ask

How do I fix parse error syntax error unexpected?

How To Fix parse error syntax error unexpected ' ' in wordpress Via FTP? In order to fix the Syntax Error in WordPress you need to edit the code that caused this error. The only possible way to resolve the syntax error is to directly exchange the faulty code via FTP or access the file you last edited using FTP.

What is PHP parse error?

If the PHP code contains a syntax error, the PHP parser cannot interpret the code and stops working. For example, a syntax error can be a forgotten quotation mark, a missing semicolon at the end of a line, missing parenthesis, or extra characters.

What is syntax error unexpected?

The JavaScript exceptions "unexpected token" occur when a specific language construct was expected, but something else was provided. This might be a simple typo.


1 Answers

Using class as a name of a constant is available in PHP 5.5 only.

To get the class name you can replace VisiteMaisonInvestisseur::class with get_class(new VisiteMaisonInvestisseur).

Or change the name of the constant. For example: VisiteMaisonInvestisseur::class_name.

like image 196
Amir Avatar answered Oct 22 '22 14:10

Amir