Welcome, Guest
Username: Password: Remember me

TOPIC: [SOLVED] Rich Text fields getting extra escape slashes

Rich Text fields getting extra escape slashes 22 Aug 2013 20:01 #10889

  • dyoungers
  • dyoungers's Avatar
  • Offline
  • Premium Member
  • Posts: 123
  • Thank you received: 16
  • Karma: 0
I have a rich text field and in the HTML double quotes (") are getting escaped with a slash and that is causing problems because they are not getting removed.

my temporary work around is to add the following code to the prepare table function in the model (using a fork):
$table->description = str_replace('\"', '"', $table->description);

I'm no expert here, and I haven't dug into this, but seems the field does need to processed to avoid SQL injection problems but not sure if double quotes need to be escaped? if so, then somewhere the slash needs to be removed. Having said that, I wonder if the code is using PHP addslashes() instead of something like the mysqli_real_escape_string() function to prepare the data?

Thanks!
Dave
The administrator has disabled public write access.

Rich Text fields getting extra escape slashes 07 Oct 2013 23:28 #11320

  • admin
  • admin's Avatar
  • Offline
  • Administrator
  • Chef
  • Posts: 3701
  • Thank you received: 972
  • Karma: 140
Sorry for answering late. I never got this problem ever.

Wich Joomla ?
Wich Editor ?

Both front and back ?

Did you tried to switch editor ?
Coding is now a piece of cake
Last Edit: 07 Oct 2013 23:29 by admin.
The administrator has disabled public write access.

Rich Text fields getting extra escape slashes 12 Nov 2014 00:02 #12761

  • rholzler
  • rholzler's Avatar
  • Offline
  • Junior Member
  • Posts: 30
  • Thank you received: 1
  • Karma: 0
I am having this same problem. This was not a problem in an earlier version of my app running on the same server as the latest version. Anytime I save items with a rich text field, the quote marks are escaped.

I enter the following code:
<p><img src="/images/Demo/iZ3.jpg" alt="" width="1368" height="768" /></p>

Press SAVE and the get the following code back:
<p><img src=\"/images/Demo/iZ3.jpg\" alt=\"\" width=\"1368\" height=\"768\" /></p>

I tried changing editors and even used the No Editor option. I tried it from both the front and back end and got the same results. I tried it with different user accounts (registered & special).

Running Joomla 2.5.27
Editors: No Editor and JCE

When I tested this in the sandbox, it does not happen.

Any ideas?

ADDITIONAL
I just tried to save an item multiple times in a row and fond that the problem becomes worse every time I save the item.
<p><img src=\\\\\"/images/Demo/iZ3.jpg\\\\\" alt=\\\\\" \\\\\"  width=\\\\\" 1368\\\\\"  height=\\\\\" 768\\\\\"  /></p>
Last Edit: 12 Nov 2014 00:14 by rholzler. Reason: Additional information.
The administrator has disabled public write access.

Rich Text fields getting extra escape slashes 12 Nov 2014 00:30 #12763

  • rholzler
  • rholzler's Avatar
  • Offline
  • Junior Member
  • Posts: 30
  • Thank you received: 1
  • Karma: 0
[SOLVED]

I reviewed the PHP settings and found that magic quotes were on. I added the following to the .htaccess file and the problem is fixed!
php_flag magic_quotes_gpc off
The administrator has disabled public write access.
Time to create page: 0.074 seconds

Get Started