PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Wednesday, February 16, 2022

[FIXED] The service "…" has a dependency on a non-existent service "property_accessor" when upgrading to Symfony 5.3

 February 16, 2022     liiptestfixturesbundle, nelmio-alice, symfony, symfony5     No comments   

Issue

We have an issue with the bundle https://github.com/liip/LiipTestFixturesBundle/tree/2.x (please note that I'm one of the maintainers of this bundle, the issue is not about using that bundle in a project)

Tests were broken on the main 2.x branch with the following error:

Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException: The service "nelmio_alice.property_accessor.std" has a dependency on a non-existent service "property_accessor". Did you mean this: "nelmio_alice.property_accessor.std"?

Here is how that service is declared in vendor/nelmio/alice/src/Bridge/Symfony/Resources/config/property_access.xml:

        <service id="nelmio_alice.property_accessor.std"
                 class="Nelmio\Alice\PropertyAccess\StdPropertyAccessor">
           <argument type="service" id="property_accessor" />
        </service>

This code should be called because NelmioAliceBundle is loaded in AppKernel.

So we added this to composer.json to forbid symfony/property-access 5.3 and it fixed the error:

"symfony/property-access": "^4.4 || ^5.0 , <5.3",

But if we remove that workaround, it breaks again. And I don't understand what is causing this issue.

Forbidding symfony/framework-bundle 5.3 also fixes the issue: https://github.com/liip/LiipTestFixturesBundle/pull/127/commits/a534419e61ef90ca2685d697b89b2ce225712cdc


What is causing the absence of property_accessor when we use symfony/framework-bundle 5.3 or symfony/property-access 5.3?


How to replicate the error

git clone git@github.com:liip/LiipTestFixturesBundle.git
cd LiipTestFixturesBundle
git checkout remove-required-symfony/property-access
composer install
vendor/bin/phpunit --testdox tests/Test/ConfigEventsTest.php

Solution

Adding property_access: ~ to the framework configuration fixed the issue (commit).

It looks like the service was missing when it wasn't configured.


The issue is reproducible on a fresh Symfony install:

$ bin/console debug:container property_accessor
[critical] Error thrown while running command "debug:container property_accessor". Message: "No services found that match "property_accessor"."

                                                     
  No services found that match "property_accessor".  

If you have that issue too, run composer require symfony/property-access.



Answered By - A.L
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing