Problem/Motivation

ArgumentCountError: Too few arguments to function Drupal\twig_field_value\Twig\Extension\FieldValueExtension::__construct(), 4 passed in /web/core/lib/Drupal/Component/DependencyInjection/Container.php on line 261 and exactly 5 expected in Drupal\twig_field_value\Twig\Extension\FieldValueExtension->__construct() (line 78 of modules/contrib/twig_field_value/src/Twig/Extension/FieldValueExtension.php).

I guess we need this in the .install file:

/**
 * Rebuild the container cache.
 */
function MYMODULE_update_NNNNNNN() {
  \Drupal::service('kernel')->rebuildContainer();
}

Steps to reproduce

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

anybody created an issue. See original summary.

anybody’s picture

anybody’s picture

Assigned: anybody » grevil
Status: Active » Needs review
anybody’s picture

@grevil: Please test and review.

grevil’s picture

Assigned: grevil » Unassigned
Status: Needs review » Reviewed & tested by the community

Usually a simple "drush cr" after the update would be enough here, but we can simply clear the cache as well! LGTM.

  • grevil committed 69676f2e on 2.0.x authored by anybody
    Issue #3471185 by anybody: 2.0.3 update should containers
    
grevil’s picture

Status: Reviewed & tested by the community » Fixed
djg_tram’s picture

Same error with updating to 2.0.4, simple cache clear doesn't help.

anybody’s picture

@djg_tram did you run updb and see the update message also?

djg_tram’s picture

I had to:

1. Manually remove the Renderer argument from the constructor.
2. Clear cache so that the site will return from WSOD.
3. Re-insert the argument.
4. Run UPDB manually, then clear cache (the second probably not required but to be sure).
5. Then it works.

Not fun. The upgrade process should be tested a bit more, I'm afraid. :-) This was on a production site that isn't used intensively yet. It would be a major PITA on a real production site.

anybody’s picture

@djg_tram it is tested, so I'm wondering how that happens. Typically only (4.) should be required.

I guess you're doing updates manually (+ update.php)?, not using composer and drush?

Just to better understand the circumstances...

djg_tram’s picture

It depends on the particular site and situation. If I'm already inside a site with smaller traffic volume and requirements (not one that postulates fully separated test and production environments, just the smaller garden variety ones), logged in and just see that a couple of modules need to be upgraded, it's usually much simpler to let it happen there with the UI and then run the update as well. I also use the new Navigation module with my own additions that make both db update and cache clear readily available. In these cases, I only fire up the console access with Drush if necessary (core upgrade needed or WSOD).

With more complex schemes I might go the Composer and Drush route immediately. I don't particulary like the Composer approach for modules, so I tend to avoid it with my own modules but that's more like a question of preferences. At any rate, even if many modules do recommend Composer, I still think that as long as Drupal actually has the old way, that should also work.

Especially as, unfortunately, it's still not always easy to set up an environment that provides full Drush/Composer functionality, I just happened on a site where drush cr works but drush updb does not because proc_open is disabled and while they offer up a few items of php.ini to customize, this isn't among those. And equally unfortunately, just telling the client to move to a better provider is not always the most feasible solution. :-)

anybody’s picture

Thanks for the details @djg_tram. Just one last question: After updating the module, were you able to access /update.php and run the update(s)?

djg_tram’s picture

No, there was a WSOD that blocked everything. I could only solve it by temporarily modifying the source code (as described above). As I do module development actively myself (both some contrib and many for in-house solutions), it was possible but not all admins are created equal. :-)

anybody’s picture

@djg_tram I tried reproducing this in several projects and environments and can't reproduce or confirm it anywhere. I think your criticism is unjustified. We also have no other reports of that issue.

So I'm finally closing this, of course I'm still sorry for the trouble you had.

Status: Fixed » Closed (fixed)

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

taran2l’s picture

@anybody hi

Unfortunately, this is not how this thing should be fixed, as update runs after cache rebuild (usually), so I can't get to that.

Core always adds a BC layer when arguments change, this should be done here as well.

anybody’s picture

Title: 2.0.3 update should containers » 2.0.3 update should rebuild containers

Thanks @taran2l,

could you please implement the suggested change to let me know, how it should be done in your opinion? This is open source, so thank you for your help and advice!

taran2l’s picture

anybody’s picture

Thanks @taran2l!