Parsing problem

Post your questions and problem reports here

Moderator: kfury77

Forum rules
Please try to follow these guidelines. This will help to receive faster and more accurate response.

  • Check the Support section of the corresponding product first. Chances are you will find your answer there;
  • Do not create new topics for already reported problems. Add your comments to the existing topics instead;
  • Create separate topic for each problem request. Do NOT post a number of non-related problem reports in a single topic;
  • Give your topic a meaningful title. Titles such as "A question," "Bug report" and "Help!" provide others no clue what your message is about;
  • Include the version number of the software you are using;
  • This is not an official customer support helpdesk. If you need a prompt and official response, please contact our support team directly instead. It may take a while until you receive a reply in the forum;

Parsing problem

Postby ToH2002 » Fri May 20, 2005 10:54 pm

Hi,

i think there may be a definite bug in the parsing/highlighting engine, when it comes to escaping backslashes:

any code after the function (which is supposed to double backslashes in a string and to escape single quotes):

Code: Select all
function for_sql($val)
{
  return str_replace("'", "\'", str_replace('\', "\\\\", $val));
}


is treated as a string literal (green). this also means that any functions following this code will not be displayed in the code explorer - this is extremely inconvenient!

When I change the code to the equivalent:
Code: Select all
function for_sql($val)
{
  return str_replace("'", "\'", str_replace(chr(0x5C), chr(0x5C) .chr(0x5C), $val));
}


everything is displayed correctly, with the functions being listed in the code explorer.

But, of course, writing things this way is REALLY cumbersome: can this be fixed?

Thanx & Regards,

Torsten
ToH2002
 
Posts: 1
Joined: Fri May 20, 2005 10:44 pm

Postby Karlis » Wed May 25, 2005 1:09 pm

Your function:

Code: Select all

function for_sql($val)
{
  return str_replace("'", "\'", str_replace('\', "\\\\", $val));
}



seems to produce php parser error:
parse error, unexpected $end in c:\web\file.php on line x

it is because \' is treated as ' (single quote is being escaped by \)

however there is aproblem with double \\ anyway, so I will take a look as time permits.
Karlis Blumentals
Blumentals Software
www.blumentals.net
User avatar
Karlis
Site Admin
 
Posts: 3601
Joined: Mon Jul 15, 2002 5:24 pm
Location: Riga, Latvia, Europe


Return to HTMLPad / Rapid CSS / Rapid PHP / WeBuilder Support

Who is online

Users browsing this forum: No registered users and 50 guests