Tell me more ×
WordPress Answers 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|improve this question
2  
Is register_globals set in php.ini by any chance?, and this does not belong on security.stackexchange.com – ewanm89 Jan 27 at 23:02
This isn't a security question. Voting to migrate. – Polynomial Jan 27 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 Answers. – akTed Jan 28 at 7:07
1  
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 at 17:34

migrated from webmasters.stackexchange.com Jan 31 at 12:50

Know someone who can answer? Share a link to this question via email, Google+, Twitter, or Facebook.

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.