Change record status: 
Project: 
Introduced in branch: 
7.x-2.x
Introduced in version: 
7.x-2.0-beta4
Description: 

The following methods have been added to FeedsFetcherResult:

  • __sleep()
  • getFeedsInProgressDir()
  • constructFilePath()
  • rawExists()
  • fileExists()
  • getFileContents()
  • checkFile()
  • saveRawToFile()
  • sanitizeRawOptimized(&$raw)

Impact

FeedsFetcherResult is the base class for all fetcher result classes. Modules that provide Feeds fetcher plugins often extend this class. These classes can have become incompatible in the following two cases:

  1. Same method name
    The fetcher result class has a method implemented with the same name as one of the newly added methods mentioned above.
    Methods that already existed on FeedsFetcherResult (like getRaw() or getFilePath()) will cause no issues, because the signature on existing methods did not change. These may just be overridden without issues.
  2. Private properties
    The fetcher result class has private properties. Since FeedsFetcherResult implements the magic method __sleep(), private properties are no longer saved when a FeedsFetcherResult instance gets serialized. This happens when a Feeds source is saved in the database with an unfinished import.

How to fix the issue of methods implemented with the same name?

If these methods don't have the same signature and the same purpose, the only solution is to rename these methods. Be sure that code that is calling these methods is adjusted as well. Note that if the methods getRaw() or getFilePath() appear in the fetcher result class it's highly unlikely that these will cause issues, since these methods are not new.

How to fix the issue when the class has private properties?

Either make these properties protected or override the __sleep() method. Be sure to return the array that the parent returns, supplemented with the private property names. If the private property doesn't need to be saved when the fetcher result class gets serialized, then you have to do nothing.

Example:

class MyFetcherResult extends FeedsFetcherResult {

  /**
   * A private variable.
   */
  private $myPrivateVar;

  /**
   * Overrides FeedsFetcherResult::__sleep().
   */
  public function __sleep() {
    $properties = parent::__sleep();

    // Save private variables when this object gets serialized.
    $properties[] = 'myPrivateVar';

    return $properties;
  }

}
Impacts: 
Module developers
Updates Done (doc team, etc.)
Online documentation: 
Not done
Theming guide: 
Not done
Module developer documentation: 
Not done
Examples project: 
Not done
Coder Review: 
Not done
Coder Upgrade: 
Not done
Other: 
Other updates done
Details: 
Progress: