Quotes and Backslashes when submitting

Quotes and Backslashes when submitting

by Jeferson Rodrigues -
Number of replies: 1

Hi guys,

I have a sinister problem in one Moodle 1.9.9+ server.

On the startup page (logged in or not), I have the Summary, and if I make a link with the HTML Editor, it makes correctly, but when I submit, the link becomes with some backslashes. See my examples above:

1) On the HTML Editor, I write a text: http://www.example.com
2) Choose the link button
3) In the field "URL" I repeated the URL: http://www.example.com
4) Click on OK button.
5) Click on Save Changes button.

And in the summary, the link is shown as: <a href="\"http://www.example.com\"">http://www.example.com</a>
and when I click him the browser goes to http://mymoodledomain.com/\"http://www.example.com\"

If I reedit the same Summary and simply press Save Changes, the link becomes with more backslashes:

http://mymoodledomain.com/\"\\\"http://www.example.com\\\"\"

And again:

http://mymoodledomain.com/\"\\\"\\\\\\\"http://www.example.com\\\\\\\"\\\"\"

I don't know what are happening with my Moodle, or my PHP.

I've tried to disable the magic_quotes_gpc, and them defined the constant MOODLE_SANE_INPUT with some value, but works parcially, because the same problem occurs too with Front Page Settings, and disabling the magic_quotes and enabling the constant, for this case not works. If I've a title with quotes, on each submit more backslashes are saved, for example:

\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"example\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\\"

Please guys, I need to solve this problem more quickly is possible.

Any sugestions?

Tks for all.

Average of ratings: -
In reply to Jeferson Rodrigues

Re: Quotes and Backslashes when submitting

by Jeferson Rodrigues -

I've encountered the problem and solved it. Was on PostgreSQL.

The 9.1 version becomes with 2 options enabled by default, and the 8.3 was off. These options are called "standard_conforming_strings" and "escape_string_warning" and are encountered on postgresql.conf.

When enabled, these options saves an escape for an escape char, that comes of PHP by the "magic_quotes_gpc" resource when submitting a form.

Tks for all!

Average of ratings: Useful (2)