chiprogrammerdude
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: wp-blog-header.php killing sessions?I ran into this problem and figured out what was happening.
I don’t use wordpress but the guy who does the SEO in my office does use wordpress for blogs for the sites i program for him.
wordpress natively assumes it’s taking over EVERY aspect of the site since it IS a content management system of some kind.
this means it naively takes over all and any global variables you have assigned for your own php scripts.
wp-blog-header.php includes a wp-config.php which also in itself includes a wp-settings.php file
In wp-settings.php:
Look at lines 27 – 47 and then look at line 47 (last line) again.
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
$noUnset = 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, $noUnset) && isset($GLOBALS[$k]) ) {
$GLOBALS[$k] = NULL;
unset($GLOBALS[$k]);
}
}wp_unregister_GLOBALS();
Session variables ARE global variables. So in effect, its calling the very function it just defined to delete ALL global variables.
I commented out
wp_unregister_GLOBALS(); and my sessions are no longer being killed.Because I’m not familiar with Word Press, I don’t know what consequences it might have to the wordpress stuff deployed on the site. The blogs seem to still work but Im gonna have the SEO guy who eats WordPress for breakfast test it.
I saw there were no resolutions regarding this subject so I registered to WordPress to fill you in on this.
I hope this helps.
Regards,
John YunForum: Fixing WordPress
In reply to: wp-blog-header.php killing sessions?