1

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.

Chin
  • 12,582
  • 38
  • 102
  • 152

1 Answers1

1

Turn off magic_quotes_gpc.

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

Phil
  • 157,677
  • 23
  • 242
  • 245
  • thanks again Phil. This is proving to be a bit of a pain. I've stripped the slashes - now when I do $id = stripslashes($_REQUEST['ID']); $idi = (int)$id; $idi = 0 but the string is "1" hmmmm I wonder why it doesn't convert. – Chin Feb 29 '12 at 06:45