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:
- 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 (likegetRaw()
orgetFilePath()
) will cause no issues, because the signature on existing methods did not change. These may just be overridden without issues. - 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;
}
}