Received: from localhost (unknown [200.46.204.183]) by mail.postgresql.org (Postfix) with ESMTP id DD58764FD05 for ; Fri, 21 Nov 2008 03:44:02 -0400 (AST) Received: from mail.postgresql.org ([200.46.204.86]) by localhost (mx1.hub.org [200.46.204.183]) (amavisd-maia, port 10024) with ESMTP id 67765-02 for ; Fri, 21 Nov 2008 03:43:58 -0400 (AST) X-Greylist: from auto-whitelisted by SQLgrey-1.7.6 Received: from out1.smtp.messagingengine.com (out1.smtp.messagingengine.com [66.111.4.25]) by mail.postgresql.org (Postfix) with ESMTP id 4AA6964FE69 for ; Fri, 21 Nov 2008 03:43:58 -0400 (AST) Received: from compute2.internal (compute2.internal [10.202.2.42]) by out1.messagingengine.com (Postfix) with ESMTP id E053C1C88A7; Fri, 21 Nov 2008 02:43:56 -0500 (EST) Received: from web5.messagingengine.com ([10.202.2.214]) by compute2.internal (MEProxy); Fri, 21 Nov 2008 02:43:56 -0500 Received: by web5.messagingengine.com (Postfix, from userid 99) id B01CC56D83; Fri, 21 Nov 2008 02:43:56 -0500 (EST) Message-Id: <1227253436.22606.1285996237@webmail.messagingengine.com> X-Sasl-Enc: 35H6H3zOlRVCJ/CgJfLYXi5UgTrf1LX13gdzMjEdmhew 1227253436 From: "V S P" To: "Chris" Cc: pgsql-php@postgresql.org Content-Disposition: inline Content-Transfer-Encoding: 7bit Content-Type: text/plain; charset="KOI8-R" MIME-Version: 1.0 X-Mailer: MessagingEngine.com Webmail Interface References: <1227250475.15555.1285991741@webmail.messagingengine.com> <492660A7.3060008@gmail.com> Subject: Re: [Q] storing JSON, problem with 'escapes' In-Reply-To: <492660A7.3060008@gmail.com> Date: Fri, 21 Nov 2008 02:43:56 -0500 X-Virus-Scanned: Maia Mailguard 1.0.1 X-Archive-Number: 200811/20 X-Sequence-Number: 3931 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