Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unexpected character in input: '\' (ASCII=92) state=1

Tags:

My client says he is getting this error using my script:

Warning: Unexpected character in input: '\' (ASCII=92) state=1 in /path/to//header.php  on line 34
Parse error: syntax error, unexpected T_STRING, expecting T_CONSTANT_ENCAPSED_STRING or '(' in/path/to/header.php  on line 34

The line 34 in header.php is just use \Main\Class;

Now, I told him he has to have PHP >= 5.3.0 and he says his PHP version is 5.3.24

What could be the problem?

EDIT: The lines before and after

30. // Define absolute path
31. define("ABSPATH", $abs_path);
32. $_SESSION["abs_path"] = ABSPATH;
33. 
34. use \CNS\main\CNS;
35. $cns = new CNS();

EDIT 2:

He sent me this:

Program     Version
Apache:     2.2.24
CentOS:     CentOS release 6.4 (Final)
cPanel:     11.36.1 (build 8)
Curl:       7.12.1
MySQL       5.5.30
phpMyAdmin  3.5.5
Python:     2.6.6
Program     Version
Perl:       5.8.8
**PHP:        5.3.24**
ionCube Loader:     4.2.2
Zend Optimizer:     3.3.9
Ruby:       1.8.7
Rails:      3.2.8
OpenSSL:    1.0.0-fips
like image 374
bosniamaj Avatar asked Jun 17 '13 20:06

bosniamaj


1 Answers

This happens if you are trying to use namespaces but do not have PHP 5.3. PHP 5.2 and below don't support namespaces and throw this error when they see the backslash.

-- Edit: mixed up the versions. It's 5.2 and below that don't have namespaces, if I'm not mistaken.

like image 149
jraede Avatar answered Sep 19 '22 05:09

jraede