PHP Classes

Malformed hexadecimal character escape sequence error

Recommend this page to a friend!

      PHP Debugger and Logger  >  All threads  >  Malformed hexadecimal character...  >  (Un) Subscribe thread alerts  
Subject:Malformed hexadecimal character...
Summary:In Xamp on Windows a Javascript error might occur due to an unes
Messages:2
Author:Bo?o Recko
Date:2013-09-10 12:41:24
Update:2013-09-10 15:20:25
 

  1. Malformed hexadecimal character...   Reply   Report abuse  
Picture of Bo?o Recko Bo?o Recko - 2013-09-10 12:41:24
I had this error on Xamp, Windows 7 home premium, Firefox 23.0.1:

SyntaxError: malformed hexadecimal character escape sequence
Source script: http://localhost/html/ptcdebug/example_ptcdebug.php#
Row: 1, Column: 60
Code:
y='none'; }}}};function read_code(filename,line) {var query="http://localhostC:\xampp\htdocs\localdocs\html\ptcdebug/Ptc

I resolved this adding addslashes() to the code that gets host and the code that gets the document root (see line 1417, the _includeJs() function):

[code]
...
function read_code(filename,line)
{
var query="http://' .

addslashes($_SERVER['HTTP_HOST']) . $path=addslashes(str_replace($_SERVER['DOCUMENT_ROOT'],'',
realpath(dirname(__FILE__)))) .

'/PtcDebug.php?file="+filename;
...

Looks like the path caused troubles, since it contains the \x sequence:

http://localhostC:\xampp\htdocs\...

  2. Re: Malformed hexadecimal character...   Reply   Report abuse  
Picture of Carlo Pietrobattista Carlo Pietrobattista - 2013-09-10 15:20:25 - In reply to message 1 from Bo?o Recko
Very interesting issue.
I will certainly include this fix in the next realese.
Thanks for the feedback!