Chin
Chin

Reputation: 12712

Get rid of all back slashes in php

woe be me...

I don't know whats happened but suddenly slashes are being added to strings in the request object.

I'm passing ID = "1" to the server;

I make up the where clause.

$where = array( 'ID' => $_REQUEST['ID']);
$result = $wpdb->update($this->the_table, $dbfields, $where);

Somehow slashes are being added and thusly the where clause doesn't match. How can I get rid of the rascals? I've tried

$where = array( 'ID' => stripslashes($_REQUEST['ID']));

and

$where = array( 'ID' => stripslashes_deep($_REQUEST['ID']));

PHP Version 5.2.17

php.ini

magic_quotes_gpc  
On  On

magic_quotes_runtime  
Off Off

magic_quotes_sybase  
Off Off

Any help much much much appreciated.

UPDATE----------------

I've turn magic_quotes_gpc off but still no joy.

if I hard code this

$where = array( 'ID' => "1");

It works fine.

However using this -

$id = stripslashes($_REQUEST['ID']);
$where = array( 'ID' => $id);

no updates are made.

If I echo out $where.

It looks like "1" - no problem.

Head scratching stuff! Worked fine a day ago.

Upvotes: 1

Views: 152

Answers (1)

Phil
Phil

Reputation: 164730

Turn off magic_quotes_gpc.

Some methods of achieving that here - http://php.net/manual/en/security.magicquotes.disabling.php

Upvotes: 1

Related Questions