Re: [Q] storing JSON, problem with 'escapes'
От | V S P |
---|---|
Тема | Re: [Q] storing JSON, problem with 'escapes' |
Дата | |
Msg-id | 1227253436.22606.1285996237@webmail.messagingengine.com обсуждение исходный текст |
Ответ на | Re: [Q] storing JSON, problem with 'escapes' (Chris <dmagick@gmail.com>) |
Список | pgsql-php |
hi, magic_quotes_gpc is on, however, the data (the strings) do not come from HTTP protocol or web pages, they come from STDIN (using popen) when invoking another program. So, at the end of the process I have "if( js_iop_lt(a,b) ){ VLADIKVLADIKVLADIKVLADIK(\"b2122\") ;}" and then I prepare an SQL statement and use bindParams to bind the string like the above to the Insert statement and I know 100% that the string has single backslash (which is how I want it to be stored -- because I want to stored as valid JSON to be read by non-php programs). But I am guessing something adds another backslash slash. after I bind the string to the insert (and I have no way to undo that because there is mechanism to get into the internal PDO structures to massage the values of the bound variables). Now, when I check what's stored in the database -- the single slash is stored -- which is correct (I think... I do not have the code to read the data back in yet). So it is almost like PosgreSQL ignores the second backslash, but warns about it?... > > For example here is a an array element > > > > "if( js_iop_lt(a,b) ){ VLADIKVLADIKVLADIKVLADIK("b2122") ;}" > > > > would get encoded in JSON as > > > > "if( js_iop_lt(a,b) ){ VLADIKVLADIKVLADIKVLADIK(\"b2122\") ;}" > > Is magic_quotes_gpc (or magic_quotes_runtime) on for the php server? > Check with a phpinfo() page. > > If so, you'll need to "undo" that, see http://www.php.net/stripslashes > (inc. the recursive function stripslashes_deep). > > -- > Postgresql & php tutorials > http://www.designmagick.com/ > -- V S P toreason@fastmail.fm -- http://www.fastmail.fm - Faster than the air-speed velocity of an unladen european swallow
В списке pgsql-php по дате отправления: