#8 patch to fix undefined etag and channel['tagline']

Chris Thomas


I have a few problems with magpierss where if i enabled
error reporting, it
would sometimes complain, maybe my feeds dont have the
fields magpie expects

an example was the that $rss->etag was undefined, which
is easy to spot,
since etag is OPTIONALLY added to the class

file: rss_fetch.inc, line 305

if( $field == 'ETag' ) {
$rss->etag = $val

since it's optional, if you attempt to access that
variable and it DOESNT
exist, php complains, nothing BAD happens, it just
complains and sometimes
loudly, displaying a message on my page about not being
able to find it,
well the fix was easy

file: rss_fetch.inc, line 160

if( $rss and isset($rss->etag) and $rss->etag and
$rss->last_modified ) {

that isset($rss->etag) makes the if() statement drop
out BEFORE it attempts
to to $rss->etag, it's called a lazy evaluator for
those who dont know,
basically it does only enough work to get the job done,
first thing it comes
across which would make the if() fail, it drops out.

the second fix I made was to a similar problem with
which didnt exist in the feed I was parsing (was a
sourceforge summary feed)
and I made a similar isset() fix that also made that
loudly complaining
message disappear too, you can find it on

rss_parse.inc, around 380, function normalize()

$this->channel['description'] = $this->channel['tagline'];

changes to

if($isset($this->channel['tagline']) ) {
$this->channel['description'] = $this->channel['tagline'];

same thing, same solution

this is my first patch, the second which comes in a
hour or so, adds the
ability to use session variables to store the cache and
that email will
explain more and why I bothered. Just to let people
know it's coming

enjoy, anyone has problems, give me a shout

chris thomas


  • Chris Thomas
    Chris Thomas

    put into magpierss directory, patch -p1 < patchname.diff