[wp-trac] [WordPress Trac] #19455: The "magic_quotes_sybase" Problem

WordPress Trac wp-trac at lists.automattic.com
Wed Dec 7 06:47:01 UTC 2011


#19455: The "magic_quotes_sybase" Problem
--------------------------+------------------------------
 Reporter:  summerblue    |       Owner:  夏天
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  General       |     Version:  3.2.1
 Severity:  normal        |  Resolution:
 Keywords:                |
--------------------------+------------------------------

Comment (by summerblue):

 Here is the solution :

 Remove the line below, it's in the "wp-settings.php" Line 33. It's in the
 wrong position!
 {{{

 @ini_set( 'magic_quotes_sybase', 0 );

 }}}

 And then, in the "wp-includes/load.php", in The function
 "wp_magic_quotes()" add the code below, immediately after "if (
 get_magic_quotes_gpc() ) {}"

 {{{
 function wp_magic_quotes() {
         // If already slashed, strip.
         if ( get_magic_quotes_gpc() ) {
                 $_GET    = stripslashes_deep( $_GET    );
                 $_POST   = stripslashes_deep( $_POST   );
                 $_COOKIE = stripslashes_deep( $_COOKIE );
         }

         // Put it right here can solve the Problem.
         // Just Mack sure turn of action is Occur after the
 "stripslashes_deep" action has done.
         if(ini_get('magic_quotes_sybase') && function_exists('ini_set')) {
                 ini_set( 'magic_quotes_sybase', 0 );
         }

         // Escape with wpdb
         $_GET    = add_magic_quotes( $_GET    );
         $_POST   = add_magic_quotes( $_POST   );
         $_COOKIE = add_magic_quotes( $_COOKIE );
         $_SERVER = add_magic_quotes( $_SERVER );

         // Force REQUEST to be GET + POST
         $_REQUEST = array_merge( $_GET, $_POST );
 }
 }
 }}}

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/19455#comment:3>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list