Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

I've been testing the Wordpress (by making about 5 requests/s) CMS, but the problem is that Apache is constantly using 100% of the CPU. Lately I've had enough of that and I've traced down a problem to the wp_unregister_GLOBALS function that's located in the /wp-includes/load.php file and called from wp-settings.php.

The function is as follows:

function wp_unregister_GLOBALS() {
        if ( !ini_get( 'register_globals' ) )
               return;

        if ( isset( $_REQUEST['GLOBALS'] ) )
               die( 'GLOBALS overwrite attempt detected' );

        // Variables that shouldn't be unset
        $no_unset = array( 'GLOBALS', '_GET', '_POST', '_COOKIE', '_REQUEST', '_SERVER', '_ENV', '_FILES', 'table_prefix' );

        $input = array_merge( $_GET, $_POST, $_COOKIE, $_SERVER, $_ENV, $_FILES, isset( $_SESSION ) && is_array( $_SESSION ) ? $_SESSION : array() );
        foreach ( $input as $k => $v )
               if ( !in_array( $k, $no_unset ) && isset( $GLOBALS[$k] ) ) {
                       $GLOBALS[$k] = null;
               unset( $GLOBALS[$k] );
               }
}

I've tried commenting out the whole function body and commenting the function call in wp-settings.php, but the Apache was still using 100% of the CPU. THe only thing that helps is chaning the name of the function; then Apache is fine and everything is OK. But I would like to know why; I know that the function unregisters the GLOBAL variables, but why is it taking up 100% of the CPU. And why is it taking up 100% of the CPU when I've commented out the entire function's body and just returning null?

If anybody know the answer to the question, please let me know; otherwise it would be great to knowing whether I can change the name of the function for good: it's just for testing purposes only.

share

migration rejected from webmasters.stackexchange.com Sep 12 '13 at 8:01

This question came from our site for pro webmasters. Votes, comments, and answers are locked due to the question being closed here, but it may be eligible for editing and reopening on the site where it originated.

closed as off-topic by kaiser, s_ha_dum, toscho Sep 12 '13 at 8:01

This question appears to be off-topic. The users who voted to close gave this specific reason:

If this question can be reworded to fit the rules in the help center, please edit the question.

3  
Is register_globals set in php.ini by any chance?, and this does not belong on security.stackexchange.com –  ewanm89 Jan 27 '13 at 23:02
    
This isn't a security question. Voting to migrate. –  Polynomial Jan 27 '13 at 23:16
1  
I think this would be better answered in Server Fault, since it seems server-related, and the fact it happens in WordPress seems incidental, hence off-topic in WordPress Development. –  akTed Jan 28 '13 at 7:07
2  
If you've "commented out the whole function body" then it can't see how it can be this function that is causing your problem. "...chaning the name of the function" - what do you mean by this? This particular function does not appear to be open to function chaining (ordinary functions rarely are)? –  w3d Jan 29 '13 at 17:34