[wp-trac] [WordPress Trac] #3996: MAGPIE_USER_AGENT lack of wp
version
WordPress Trac
wp-trac at lists.automattic.com
Mon Mar 19 00:12:12 GMT 2007
#3996: MAGPIE_USER_AGENT lack of wp version
----------------------------+-----------------------------------------------
Reporter: hakre | Owner: anonymous
Type: enhancement | Status: new
Priority: normal | Milestone: 2.1.3
Component: Administration | Version: 2.1.2
Severity: normal | Keywords: rss magpie snoopy
----------------------------+-----------------------------------------------
Due to an error, the global variable $wp_version is not imported into the
local namespace of the init function within wp-includes/rss.php (~ line
565). It is used ~ line 594 where the MAGPIE_USER_AGENT is defined (if not
already defined before ~ line 12). Because the variable does not exists
in the namespace there, it should changed to $GLOBALS!['wp_version'].
{{{
change from:
$ua = 'WordPress/' . $wp_version;
change to:
$ua = 'WordPress/' . $GLOBALS['wp_version'];
}}}
this is an error by design. let's face it, the real mess starts a lot
earlier in line 12:
{{{
define('MAGPIE_USER_AGENT', 'WordPress/' . $wp_version);
}}}
this is the place where the constant is defined first. at this time
$wp_version is not set (version.php not included). a workaround would be
to ask for existance of $wp_version before defining the constant:
{{{
if (isset($wp_version)) define('MAGPIE_USER_AGENT', 'WordPress/' .
$wp_version);
}}}
but this might create overhead and other problems as well because it might
no be defined when it is assumed that it is. therefore i suggest to
include version.php before including rss.php since rss.php is based on
version.php.
version.php is included in wp-settings.php on line 171
rss.php is included in my case in a widget within my template. since all
the template related stuff is loaded via template loader in wp-blog-
header.php, this results in being in index.php on line 4.
I'm quite new to wordpress development, but shouldn't it make sense to
include version.php in index.php already? or should rss.php have a
include_once('version.php') inside? whatever in my case the isset() option
describben above did the job for me quite well.
--
Ticket URL: <http://trac.wordpress.org/ticket/3996>
WordPress Trac <http://trac.wordpress.org/>
WordPress blogging software
More information about the wp-trac
mailing list