PHP Classes

False negatives

Recommend this page to a friend!

      Feed Validator  >  All threads  >  False negatives  >  (Un) Subscribe thread alerts  
Subject:False negatives
Summary:Returns FALSE if feed text includes "Sorry"
Messages:3
Author:Andrew Rich
Date:2010-09-02 18:29:48
Update:2013-07-30 05:15:19
 

  1. False negatives   Reply   Report abuse  
Picture of Andrew Rich Andrew Rich - 2010-09-02 18:29:48
This class improperly returns FALSE if the feed text, as shown in FeedValidator.org, contains the word "Sorry" if the feed successfully validated with recommendations. Instead the class should perhaps search for "This is a valid RSS feed".

  2. Re: False negatives   Reply   Report abuse  
Picture of Andrew Rich Andrew Rich - 2010-09-02 19:03:02 - In reply to message 1 from Andrew Rich
Looking more closely at the code, it always fails because $this->get($feed) returns NULL.

Revised, working code in function validate:


$this->get($feed);
if ( !empty($this->buffer) && preg_match ( "/\\[Valid RSS\\]/is", $this->buffer )) {
// we got the feed, it's not empty and contains "[Valid RSS]"
return true;
} else {
// we didn't get the feed, it's empty or it doesn't contain "[Valid RSS]"
return false;
} // if

  3. Re: False negatives   Reply   Report abuse  
Picture of Matt Short Matt Short - 2013-07-30 05:15:19 - In reply to message 2 from Andrew Rich
I copied and pasted your code bite right over the bad code and tried it. I still get an invalid feed, even though I can paste the same feed right into feedvalidator's site and it claims it's valid.

Thoughts as to what I am doing wrong?