Forums / Bug Reports / 1.3.7.1: EZ Pages editor fails to properly escape backslash

1.3.7.1: EZ Pages editor fails to properly escape backslash

Locked

Views: 1,627

Results 1 to 2 of 2
This thread is locked. New replies are disabled.
13 Jul 2007, 3:01 AM
#1
razathorn avatar

razathorn

New Zenner

Join Date:
May 2006
Posts:
18
Plugin Contributions:
0

1.3.7.1: EZ Pages editor fails to properly escape backslash

I wrote a small block of javascript that included some backslashes in an easy page. I noted that \ gets erased on save, and \ is turned into \ (double into single backslash). This would seem to indicate that something is failing to properly escape backslashes before passing them to the database. Perhaps this code is expecting stuff to be pre-slashed by php?

Wayne

29 Sep 2007, 11:12 AM
#2
emupilot avatar

emupilot

New Zenner

Join Date:
Sep 2007
Posts:
21
Plugin Contributions:
1

Re: 1.3.7.1: EZ Pages editor fails to properly escape backslash

This same problem was ruining some client-side JavaScript I was putting in an ez-page. I found out why this happens too. That old enemy stripslashes() is the culprit and it's being called without first seeing if get_magic_quotes_gpc() is true.
The state of Magic quotes should never be assumed and its use is condemned anyway. I think the same problem arises elsewhere too.

You can fix it by correcting the second line of zen_db_prepare_input() (about line line 83 of database.php):

return trim(get_magic_quotes_gpc() ? stripslashes($string) : $string);