Problem/Motivation

We are getting the following error from the aggregator module, when trying to import new items from a XML feed.

Zend\Feed\Reader\Exception\RuntimeException: Could not load extension: GooglePlayPodcast using Plugin Loader. Check prefix paths are configured and extension exists. i Zend\Feed\Reader\Reader::registerExtension() (line 590 af /.../vendor/zendframework/zend-feed/src/Reader/Reader.php).

As far as I can see it's related to the zend-feed component from the Zend Framework. The zend-feed component was updated on the 24th of May and the error could be related to that update as it concerns the Google Play Podcasts DTD.

https://github.com/zendframework/zend-feed/releases/tag/release-2.10.0

Does anyone have a clue of what to do about this? Is this an issue in the aggregator module or in the zend-feed component?

Is there a way to downgrade the zend-feed component to a previous version temporarily?

Proposed resolution

The problem is caused by the fact we maintain a list of all the Zend extensions in core.services.yml. This list can change as Zend updates - which with a composer driven workflow we are not 100% in control of which version different sites are on. Fortunately in 24 Feb 2015 Zend-Feed added some standalone extension managers that make this much easier to solve.

Remaining tasks

User interface changes

None

API changes

None

Data model changes

None

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

HenrikBak created an issue. See original summary.

Erik Frèrejean’s picture

Assigned: Unassigned » Erik Frèrejean
Priority: Normal » Major

This is cause by the new reader/writers in the zend extension that aren't added to the Drupal service definition yet.

Erik Frèrejean’s picture

Title: Could not load extension: GooglePlayPodcast using Plugin Loader » New zend feed plugins missing from zend bridge
Version: 8.5.3 » 8.5.x-dev
Component: aggregator.module » base system
Assigned: Erik Frèrejean » Unassigned
Status: Active » Needs review
FileSize
1.11 KB

Added a patch, but this is more a base system issue then an aggregator module since the issue arises from the zend bridge.

HenrikBak’s picture

I have applied the patch to our website (Core 8.5.3) and our aggregator import is working as expected again. Thanks!

liesm’s picture

Status: Needs review » Reviewed & tested by the community

Encountered the same issue and the patch in #3, resolves the issue.

catch’s picture

Priority: Major » Critical

Bumping this to critical because it's a fatal error during normal site operation. However, it's very unfortunate that these need to be registered as services just in case they might get used. #2025643: Add proxy services to Zend\Reader and Zend\Writer for better DX is an old issue but IMO a better long term approach.

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Then we need to bump the version of Zend to actually have these classes.

From composer.lock:

            "name": "zendframework/zend-feed",
            "version": "2.7.0",

I'm not entirely sure this is a bug. It's tricky. Somehow @HenrikBak must have upgraded zend-feed to have these classes. If you upgrade a dependency are you responsible for adding the services?

Erik Frèrejean’s picture

@alexpott, the composer file itself has the version constraint
"zendframework/zend-feed": "^2.4",
So if you manage a project with composer for example using drupal-composer/drupal-project, as suggested in the documentation, you'll get (at the moment) version 2.10.1 of the zendframework/zend-feed library and not 2.7.0 as defined in the Drupal core composer.lock file.

[vagrant@kennismeester]$ composer create-project drupal-composer/drupal-project:8.x-dev some-dir --stability dev --no-interaction
........
  - Installing zendframework/zend-stdlib (3.2.0): Loading from cache
  - Installing zendframework/zend-escaper (2.6.0): Loading from cache
  - Installing zendframework/zend-feed (2.10.1): Loading from cache
  - Installing zendframework/zend-diactoros (1.7.2): Loading from cache
alexpott’s picture

@Erik Frèrejean yep I get that but that still means in order to fix this we either need to declare we are incompatible with 2.10 (not a good option for 8.6.x which we have to fix first) - or bump the version in core/composer.json and composer.lock

I'm in favour of making this a duplicate of #2025643: Add proxy services to Zend\Reader and Zend\Writer for better DX - @Erik Frèrejean / @HenrikBak it'd be awesome if you could try the patch on that issue and see if it fixes your problem. If it does can you close this one as a duplicate or perhaps change this into a task to update Zend-Feed before 8.6.0? Thanks.

alexpott’s picture

Version: 8.5.x-dev » 8.6.x-dev
Issue summary: View changes
Status: Needs work » Needs review
FileSize
7.23 KB

Changed my mind after talking to @catch - this issue can proceed as a bug fix. The scope of #2025643: Add proxy services to Zend\Reader and Zend\Writer for better DX is subtly different - it is aiming to improve the API. After doing this issue things get a lot simpler for that one.

No interdiff because new approach and changing to 8.6.x as we have to fix there first.

alexpott’s picture

Title: New zend feed plugins missing from zend bridge » Use Zend-Feed's standalone extension managers to prevent sites breaking
alexpott’s picture

Updated patch to have CR in deprecation messages.

andypost’s picture

+++ b/core/core.services.yml
@@ -1415,80 +1415,95 @@ services:
+    deprecated: The "%service_id%" service is deprecated. You should use the 'feed.bridge.reader' to create a reader instead. See https://www.drupal.org/node/2979042 See https://www.drupal.org/node/2979042

duplicated "See http"

alexpott’s picture

The standalone extension managers have been around since Zend-Feed 2.4.0 - https://github.com/zendframework/zend-feed/tree/release-2.4.0/src/Reader so we don't need to bump the version in the composer.json file here either.

alexpott’s picture

Thanks @andypost - fixed.

andypost’s picture

alexpott’s picture

@andypost but thats not related to this issue. Yes sure for that issue we need to bump the version but we don't need to fix this specific issue.

andypost’s picture

Status: Needs review » Reviewed & tested by the community

Cr filed & good to go

alexpott’s picture

It'd be great to have confirmation from @HenrikBak or @Erik Frèrejean that the current fix works for them. I think it should but obviously we have no explicit test for GooglePlayPodcast

Erik Frèrejean’s picture

I've been running the patch in #15, on one of our production sites for the last couple of hours and haven't seen any issues so far.

catch’s picture

Not quite committing yet but just to say #15 looks great.

ghalenir’s picture

I applied the patch from #15 but I still see this issue.

Could not load extension: GeoRSS using Plugin Loader. Check prefix paths are configured and extension exists.

alexpott’s picture

@ghalenir did you rebuild the container after applying the patch?

alexpott’s picture

@ghalenir actually where is the GeoRSS coming from? It doesn't appear to be part of https://github.com/zendframework/zend-feed

alexpott’s picture

Status: Reviewed & tested by the community » Needs work

Talked to @ghalenir in Slack. Discovered that this approach breaks the feeds module :( Because the feeds module registers it's own extensions by doing

   $result = new ParserResult();
   Reader::setExtensionManager(\Drupal::service(‘feed.bridge.reader’));
   Reader::registerExtension(‘GeoRSS’);

We can't break this.

ghalenir’s picture

I removed the #15 patch from the composer and added this
composer require --dev zendframework/zend-feed:2.7.0 It worked now.

alexpott’s picture

Status: Needs work » Needs review
FileSize
5.88 KB
10.9 KB

Here's an approach that should work with feeds. I've installed the Feeds module and done the exact same code as in #25 and it no longer errors. The patch still gets us to a place where core doesn't need to have all the zend services in the container and we use the standalone extension managers from Zend but we still have our bridge in place. The change is that the bridge sort of decorates a standalone extension manager and uses that first then resorts to the container if it can't find it.

It might be worth considering changing this around so we check the container first. That way if someone has replaced feed.reader.* service in the container we'll still use their replacement.

alexpott’s picture

So... the

+++ b/core/core.services.yml
@@ -1418,77 +1418,100 @@ services:
   feed.reader.atomfeed:
     class: Zend\Feed\Reader\Extension\Atom\Feed
     shared: false
+    deprecated: The "%service_id%" service is deprecated. You should use the 'feed.bridge.reader' to create a reader instead. See https://www.drupal.org/node/2979042

deprecated: does very little because deprecations are not triggered on Container::get(). This only works when a service is used by ContainerBuilder. For example try \Drupal::service('router.matcher');. The service is deprecated but this won't trigger a message.

Given that deprecating these things here is pretty pointless. I'm also thinking that minimising any BC breaks for a critical fix is a good thing so here's a patch with no deprecations and no BC impact unless you've replaced the feed.bridge.reader or feed.bridge.writer services. I'll update the CR to reflect all of this later.

Erik Frèrejean’s picture

I've just applied the patch in #28 without an issue, but the feed we're watching won't receive new data before noon tomorrow (UTC), so I'll check back after it has ran for any issues.

alexpott’s picture

@Erik Frèrejean thanks for testing this - looking forward to the results :)

I've updated https://www.drupal.org/node/2979042 to reflect the new patch.

Erik Frèrejean’s picture

Issue summary: View changes
Status: Needs review » Reviewed & tested by the community

Our feed has just ran and works as expected, new content has been created as usual and no errors in the logs, the CR seems okay as well.

On a side note, I'd feel that deprecating the services at this point (even from just a documentation point of view), makes a lot of sense. But I can follow the logic to not include that in this patch. With that updated the issue description to reflect the fact that there are no deprecations anymore.

Erik Frèrejean’s picture

Created a followup issue to mark the services as deprecated. #2979588: Deprecate Laminas\Feed reader and writer services

larowlan’s picture

Status: Reviewed & tested by the community » Needs review
+++ b/core/lib/Drupal/Component/Bridge/ZfExtensionManagerSfContainer.php
@@ -62,14 +68,25 @@ public function __construct($prefix = '') {
+    try {
+      return $this->container->get($this->prefix . $this->canonicalizeName($extension));
+    }
+    catch (ServiceNotFoundException $e) {

would it be more efficient to use $this->container->has() instead of using Exceptions for logic flow?

We even have our own has method we could check first instead of relying on the exception

alexpott’s picture

Status: Needs review » Reviewed & tested by the community

Throwing the exception maintains the current behaviour. I think that it is the right thing to do. Here's the current get method:

  /**
   * {@inheritdoc}
   */
  public function get($extension) {
    return $this->container->get($this->prefix . $this->canonicalizeName($extension));
  }
alexpott’s picture

Let's add a test for the behaviour.

catch’s picture

Just to say #35 looks fine to me, and thanks Erik Frèrejean for opening the follow-up.

Tests still running..

mwop’s picture

Just FYI: we will be rolling out version 2.10.2 later today, which makes the GooglePlayPodcast extension registration conditional on its presence in the extension manager.

catch’s picture

@mwop thanks for the heads-up, that release is now here: https://github.com/zendframework/zend-feed/releases/tag/release-2.10.2

Status: Reviewed & tested by the community » Needs work

The last submitted patch, 35: 2976335-35.patch, failed testing. View results

Version: 8.6.x-dev » 8.7.x-dev

Drupal 8.6.0-alpha1 will be released the week of July 16, 2018, which means new developments and disruptive changes should now be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

catch’s picture

Status: Needs work » Reviewed & tested by the community

Looks like that was a test bot hiccup, retested and restoring previous status.

catch’s picture

Status: Reviewed & tested by the community » Fixed

Committed/pushed to 8.7.x and cherry-picked to 8.6.x. Thanks!

  • catch committed 68eee65 on 8.7.x
    Issue #2976335 by alexpott, Erik Frèrejean, HenrikBak, andypost: Use...

  • catch committed ac3e741 on 8.6.x
    Issue #2976335 by alexpott, Erik Frèrejean, HenrikBak, andypost: Use...
xjm’s picture

Version: 8.7.x-dev » 8.6.x-dev
xjm’s picture

Version: 8.6.x-dev » 8.5.x-dev
Status: Fixed » Reviewed & tested by the community
FileSize
6.56 KB

Testing an 8.5.x backport since this is a critical.

Version: 8.5.x-dev » 8.6.x-dev

Drupal 8.5.6 was released on August 1, 2018 and is the final bugfix release for the Drupal 8.5.x series. Drupal 8.5.x will not receive any further development aside from security fixes. Sites should prepare to update to 8.6.0 on September 5, 2018. (Drupal 8.6.0-rc1 is available for testing.)

Bug reports should be targeted against the 8.6.x-dev branch from now on, and new development or disruptive changes should be targeted against the 8.7.x-dev branch. For more information see the Drupal 8 minor version schedule and the Allowed changes during the Drupal 8 release cycle.

mandclu’s picture

I just ran into an issue that seems related to this, and reported it in #2996277: Aggregator throws Zend Feed errors and won't import. If anyone here has ideas on what could be done to resolve it, I would greatly appreciate it.

xjm’s picture

Status: Reviewed & tested by the community » Needs work
Issue tags: +Needs change record updates

The CR https://www.drupal.org/node/2979042 could probably use a little more detail explaining to site owners what the impact of fixing this bug is for them.

catch’s picture

Status: Needs work » Fixed

This has been out in a release for a while now, and I don't think we can commit this to 8.5.0 any more, so moving back to fixed.

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.