From 8b349590bbdc06c8def9667b2b8b833e9721bf1f Mon Sep 17 00:00:00 2001 From: ryan Date: Wed, 31 Dec 2008 22:09:57 +0000 Subject: [PATCH] Turn off magic_quotes_sybase. It prevents addslashes from escaping backslashes. fixes #8757 for trunk git-svn-id: http://svn.automattic.com/wordpress/trunk@10286 1a063a9b-81f0-0310-95a4-ce76da25c4cd --- wp-includes/functions.php | 12 +++++++++--- wp-settings.php | 2 ++ 2 files changed, 11 insertions(+), 3 deletions(-) diff --git a/wp-includes/functions.php b/wp-includes/functions.php index de8c89cbc9..b687288906 100644 --- a/wp-includes/functions.php +++ b/wp-includes/functions.php @@ -529,6 +529,7 @@ function update_option( $option_name, $newvalue ) { return true; } +error_log(var_export($newvalue, true)); $notoptions = wp_cache_get( 'notoptions', 'options' ); if ( is_array( $notoptions ) && isset( $notoptions[$option_name] ) ) { unset( $notoptions[$option_name] ); @@ -537,7 +538,8 @@ function update_option( $option_name, $newvalue ) { $_newvalue = $newvalue; $newvalue = maybe_serialize( $newvalue ); - +error_log(var_export($newvalue, true)); + $alloptions = wp_load_alloptions(); if ( isset( $alloptions[$option_name] ) ) { $alloptions[$option_name] = $newvalue; @@ -545,6 +547,8 @@ function update_option( $option_name, $newvalue ) { } else { wp_cache_set( $option_name, $newvalue, 'options' ); } +$prep = $wpdb->prepare( "UPDATE $wpdb->options SET option_value = %s WHERE option_name = %s", $newvalue, $option_name ); +error_log(var_export($prep, true)); $wpdb->query( $wpdb->prepare( "UPDATE $wpdb->options SET option_value = %s WHERE option_name = %s", $newvalue, $option_name ) ); if ( $wpdb->rows_affected == 1 ) { @@ -587,6 +591,7 @@ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) { wp_protect_special_option( $name ); $safe_name = $wpdb->escape( $name ); + error_log('Incoming ' . var_export($value, true)); $value = sanitize_option( $name, $value ); // Make sure the option doesn't already exist. We can check the 'notoptions' cache before we ask for a db query @@ -597,7 +602,7 @@ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) { $value = maybe_serialize( $value ); $autoload = ( 'no' === $autoload ) ? 'no' : 'yes'; - +error_log('Serialize ' . var_export($value, true)); if ( 'yes' == $autoload ) { $alloptions = wp_load_alloptions(); $alloptions[$name] = $value; @@ -612,7 +617,8 @@ function add_option( $name, $value = '', $deprecated = '', $autoload = 'yes' ) { unset( $notoptions[$name] ); wp_cache_set( 'notoptions', $notoptions, 'options' ); } - +$prep = $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload ); +error_log('Prepare ' . var_export($prep, true)); $wpdb->query( $wpdb->prepare( "INSERT INTO $wpdb->options (option_name, option_value, autoload) VALUES (%s, %s, %s)", $name, $value, $autoload ) ); do_action( "add_option_{$name}", $name, $value ); diff --git a/wp-settings.php b/wp-settings.php index 6e7f443d5a..692370dfca 100644 --- a/wp-settings.php +++ b/wp-settings.php @@ -15,6 +15,8 @@ if ( !defined('WP_MEMORY_LIMIT') ) if ( function_exists('memory_get_usage') && ( (int) @ini_get('memory_limit') < abs(intval(WP_MEMORY_LIMIT)) ) ) @ini_set('memory_limit', WP_MEMORY_LIMIT); +set_magic_quotes_runtime(0); +@ini_set('magic_quotes_sybase', 0); /** * Turn register globals off.