textarea in a form with May-to-Many escapes quotes?

Any tips and tricks that has to with the ADDT that doesn't fit into one of the other categories
antonio
Posts: 77
Joined: 2010-09-28 11:48

textarea in a form with May-to-Many escapes quotes?

Post by antonio » 2012-09-06 09:31

Hi all,
I have a strange problem.
I have a form that updates records in a db. Nothing strange here.
This form contains some texarea fields.
Some fields are standard textareas, while others are textareas created by the Many-To-Many (M-T-M) addt server behaviour.

When I input some text with quotes and other symbols in standard textareas there is no problem: the text is showed corretly on web pages.
But when I input some text and special characters (quotes, for example) in textareas created by the M-T-M addt server behaviour the text gets changed and all quotes are rendered with backslashes.
Example:
entering some 'text' with quotes I get this some \'text\' with quotes.
Updating the same record and saving it without changing anything will display this: some \\'text\\' with quotes.

Any idea on how to fix this?

Addendum: it seems that this problem is related to the 'magic_quote" settings in the server php.ini.
So, is there a way to disable it locally (only on a specific folder and subfolder) leaving intact this settings for other folders?
I think the best solution is to fix the different M-T-M server behaviour, bt I'm not such a good programmer and I would screw things up.... :(

TIA

tony

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: textarea in a form with May-to-Many escapes quotes?

Post by Fred » 2012-09-06 20:18

Good idea to disable magic_quotes on your server anyway as it is deprecated in php 5.3 and removed in php5.4.0

Anyway it sounds like your text get a double escape applied to it for some reason. Do you manually escape anything?

antonio
Posts: 77
Joined: 2010-09-28 11:48

Re: textarea in a form with May-to-Many escapes quotes?

Post by antonio » 2012-09-07 10:27

Hi Fred,
Fred wrote:Good idea to disable magic_quotes on your server anyway as it is deprecated in php 5.3 and removed in php5.4.0
Thanks for your confirmation.
Fred wrote:Anyway it sounds like your text get a double escape applied to it for some reason. Do you manually escape anything?
No, I do not escape anything manually.
I'm pretty sure that the problem is related to the Many-To-Many server behaviour. In fact, on other textareas I don't have this problem.
But if you have a textarea that falls inside the area created by the M-T-M server behaviour you'll get all quotes escaped.
Can't understand why this happens; the function that is called is the same as other textarea (KT_escapeAttribute).

So, I disabled magic_quote_gpc on the server directly (putting a specific php.ini on the same folder that contains my back-end pages).

it works now.

Ciao ;).

tony

User avatar
Fred
Site Admin
Posts: 491
Joined: 2010-02-15 12:10
Location: Armagh, Northern Ireland
Contact:

Re: textarea in a form with May-to-Many escapes quotes?

Post by Fred » 2012-09-07 12:40

I suppose this is then a good example of why it is not a good idea to use magic_quotes.

Glad you got it sorted.

Post Reply