Warning: Unexpected character in input: ‘\’ (ASCII=92)
Posted on September 2, 2011
I’ve just started out using CodeIgniter 2 and wanted to add Doctrine 2. There are many great resources that shows an easy way to get these to work together.
I followed several examples and spent a day or so trying to debug the magic. The magic is the one reason I tend to stay away from frameworks. However as technology speeds it’s way forward, I felt to stay competitive, I needed to learn to lean on a framework.
With each attempt I got the
“Warning: Unexpected character in input: ‘\’ (ASCII=92) state=1 in /var/www/html/application/libraries/Doctrine.php on line 17”
or some variant of this error. I was using an older test server which had PHP 5.2. The one drawback of having many different servers is keeping them all updated. As it turns out PHP 5.2 was the issue, D2 require PHP 5.3, I checked the code out to another server running PHP 5.3 and like magic everything worked as expected.
I also got this error when trying to install activeRecord in CodeIgniter. There is a little issue with CodeIgniter 2.0.3 which has changed a function name in the Loader.php core class. Once I changed the My_Loader class to work around the name change, I still got the “Warning: Unexpected character in input: ‘\’ (ASCII=92) …” error.
I always Google any strange errors in hopes to finding a quick solution. However the only thing I really found was the question and no answers. So I hope this helps save some time for those who are edger to get started and a slight oversight on checking the frameworks requirements.