php - get un escaped POST not magic quoted values in wordpress? -
following question : with "magic quotes" disabled, why php/wordpress continue auto-escape post data?
in wordpress, superglobals espaced if magic quotes off
so, following answer : https://stackoverflow.com/a/8949871/1334268
if create plugin , class access raw post, get, etc.. , solution? see drawbacks, issues whatsoever in such approach. here plugin below:
class mypluginrequest{ public static function getpost( $key ){ global $_real_post; return isset( $_real_post[ $key ] )? $_real_post[ $key ] : false ; } } // hack cope un-configurable call wp_magic_quotes // e.g. make original $_post available through global $_real_post global $_real_get, $_real_post, $_real_cookie, $_real_request; $_real_get = $_get; $_real_post = $_post; $_real_cookie = $_cookie; $_real_request = $_request; i use mypluginrequest::getpost( 'submit' ); everytime need posted unescaped value.
does $wpdb->escape expects magic quoted value or unescaped one?
that looks should work fine. on later part of question believe $wpdb->escape deprecated, per comment block
/** * not use, deprecated. * * use esc_sql() or wpdb::prepare() instead. * * ... looking through wordpress code determine if wpdb::prepare expects magic quoted value leads quagmire of horrid wp code... >bites tounge<
it looks expects non-magic-quoted strings me, there's chance won't double escape if pass magic quoted string, though i'd verify test.
Comments
Post a Comment