[SOLVED] Inserting \ before "

[SOLVED] Inserting \ before "

Postby rokxer » Fri Jun 26, 2009 9:17 pm

I made a table in the news with the following code:
Code: Select all
<table style="border-collapse: collapse;" align="Default" bgcolor="#ccff66" border="1" bordercolor="#000033" cellpadding="0" cellspacing="0" width="200"><tbody><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table>

Post news.

The table displays ok. Next i try to edit the news with the table. This come up:
Code: Select all
<table style=\"border-collapse: collapse;\" align=\"Default\" bgcolor=\"#aaff66\" border=\"1\" bordercolor=\"#000033\" cellpadding=\"0\" cellspacing=\"0\" width=\"200\"><tbody><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table>


Post news. When editing again:
Code: Select all
<table style=\\\"border-collapse: collapse;\\\" align=\\\"Default\\\" bgcolor=\\\"#aaff66\\\" border=\\\"1\\\" bordercolor=\\\"#000033\\\" cellpadding=\\\"0\\\" cellspacing=\\\"0\\\" width=\\\"200\\\"><tbody><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr><tr><td>&nbsp;</td><td>&nbsp;</td></tr></tbody></table>


Everything is working fine only the code gets messed more each time i am editing the news. It is inserting slashes( \ ) befor each ". In version 2 html works ok.

Another example: When inserting pictures with the editor
Code: Select all
[img align=\"\" border=\"0\" alt=\" \"]http://www.rasmusklan.dk/new/xnews3-0-0/uploads/pictures/les.jpg[/img]

The picture is not displayed.
rokxer
 
Posts: 108
Joined: Tue Jun 02, 2009 11:25 am

Re: Bug: Inserting \ before "

Postby Karise » Fri Jun 26, 2009 9:31 pm

Samme happens for me ...
Karise
 
Posts: 20
Joined: Mon Jun 15, 2009 8:19 pm

Re: Bug: Inserting \ before "

Postby Karise » Sun Jun 28, 2009 10:10 pm

I found same error in editing templates...
Karise
 
Posts: 20
Joined: Mon Jun 15, 2009 8:19 pm

Re: Bug: Inserting \ before "

Postby evan » Tue Oct 13, 2009 1:59 pm

The same thing happens to me when uploading images to display along with an article. Just before I press the "publish" button, everything looks OK. But then, backslashes are inserted and images cannot be displayed.

Example before pushing "publish":
Code: Select all
<IMG border=0 alt=" " align=left src="http://www.mysite.com/xn3gr/uploads/pictures/1063265_b.jpg" width=256 height=184>


Example after publishing and returning to the editor:
Code: Select all
<IMG border=0 alt='\"' align=left src='\"http://www.mysite.com/xn3gr/uploads/pictures/1063265_b.jpg\"' width=256 height=184 \?>


Furthermore, the same thing happens within the article. When the characters ' and " are encountered, backslashes are added before them.

Example of original text: "That's pretty amazing, winning the Nobel Peace Prize," Jay Leno said Friday night of President Barack Obama's latest accolade. "Ironically, his biggest accomplishment as president so far ... winning the Nobel Peace Prize."

The published article looks like this: \"That\'s pretty amazing, winning the Nobel Peace Prize,\" Jay Leno said Friday night of President Barack Obama\'s latest accolade. \"Ironically, his biggest accomplishment as president so far ... winning the Nobel Peace Prize.\"

Very frustrating, please help!
evan
 
Posts: 26
Joined: Thu Aug 13, 2009 4:25 pm

Re: Bug: Inserting \ before "

Postby rokxer » Mon Oct 19, 2009 7:58 pm

Strange, now everything is working fine. :o
I just downloaded the news 3 again, installed and the error is not present any more. I don't know what i did in the meantime.
rokxer
 
Posts: 108
Joined: Tue Jun 02, 2009 11:25 am

Re: Bug: Inserting \ before "

Postby evan » Tue Oct 20, 2009 11:34 am

The thing is that when I installed xnews 3 beta locally, on my computer using Windows XP/IIS for testing, no such problem occured, apart from the inability of pasting text into the fields for my articles. Now that I am ready to take my website on the air, where my host uses Linux, I came across the above bug. On the other hand, the problem with pasting text has vanished. I already have problems installing the script as I described in another topic, I have installed it several times. Unless something has changed, I really see no reason downloading and installing it all over again. Will try it though, this bug is the only thing that prevents me from launching my website -and I am already overdue...
evan
 
Posts: 26
Joined: Thu Aug 13, 2009 4:25 pm

Re: Bug: Inserting \ before "

Postby rokxer » Tue Oct 20, 2009 8:31 pm

I use apache on windows and linux and it is working fine. php version is 5.2.9. Maybe you have php 5.3.0 ? booo i dont know. Maybe it could me a SQL database problem.

i doubt it is the operating system. I suspect or php or some browser bug. I tried with IE8 and firefox 3.5 and it was working fine.

an you give me a link to your website and create an account for me so i can do some more testing?
Can you post any of your specifications?
rokxer
 
Posts: 108
Joined: Tue Jun 02, 2009 11:25 am

Re: Bug: Inserting \ before "

Postby evan » Wed Oct 21, 2009 10:32 am

As I suspected, I downloaded xnews3, installed it and... just the same.
My cpanel info are:
Apache version 1.3.41 (Unix)
PHP version 5.2.8
MySQL version 4.1.22-standard
Operating system Linux

Here is a screenshot of my php configuration http://img194.imageshack.us/img194/640/phpconfig.jpg

For the record, when testing the script locally under windows XP/IIS, I used PHP 5.3 and mysql 5.1.37.
Could any of the above be the problem? rokxer I'll send you a PM with my account info. Thank you very much!
evan
 
Posts: 26
Joined: Thu Aug 13, 2009 4:25 pm

Re: Bug: Inserting \ before "

Postby rokxer » Wed Oct 21, 2009 11:55 am

The reason for this bug is in PHP v5. It has Magic qoutes enabled so it inserts slashes before \ , ' and ".
You can read more about it here -> http://www.tizag.com/phpT/php-magic-quotes.php

It should be mentioned/tested during the install that enabled magic qoutes will cause errors.
rokxer
 
Posts: 108
Joined: Tue Jun 02, 2009 11:25 am

Re: [SOLVED] Inserting \ before "

Postby andrei » Sat Mar 06, 2010 12:02 am

As of RC2, a function to strip unwanted slashes has been implemented. It is called on all input sources (GET/POST/COOKIE) if the script is running on a PHP configuration with magic quotes on.

However, if you have access to your PHP settings, turn off magic quotes to avoid calling the function I mentioned above, thus saving a few more miliseconds of execution time.
Andrei Dumitrache
Owner and developer of Xpression News
andrei
Site Admin
 
Posts: 29
Joined: Mon Jun 01, 2009 8:32 pm

Re: [SOLVED] Inserting \ before "

Postby evan » Tue Jul 27, 2010 9:06 pm

andrew39 wrote:*Removed spam post*

Well, if you have no access to your server and cannot turn magic quotes off in your php.ini, you can try a workaround that rokxer invented. Using a text editor, create a document that contains the following line: "magic_quotes_gpc = Off" (without the ""). Save it as php.ini. Copy this file and paste it to the root and to every folder and subfolder of your xpression news installation. Worked for me!
evan
 
Posts: 26
Joined: Thu Aug 13, 2009 4:25 pm


Return to Beta 3.0.0

Who is online

Users browsing this forum: No registered users and 1 guest

cron