FriendsOfSymfony / FOSUserBundle

Provides user management for your Symfony project. Compatible with Doctrine ORM & ODM, and custom storages.
https://symfony.com/doc/master/bundles/FOSUserBundle/index.html
MIT License
3.25k stars 1.57k forks source link

XmlDriver Exception migrating to PHP 8.2 #3065

Closed yard-mschwartz closed 6 months ago

yard-mschwartz commented 7 months ago

Symfony FOSUserBundle versions: dev-master (v3.2.1 at the time of writing)

Description of the problem including expected versus actual behavior:

Application runs just fine on PHP 7.4, but of course we need to migrate to PHP 8.x rather sooner than later. After setting the PHP-version to ^8.2 and running composer update, Symfony automatically runs symfony console cache:clear for us. Then the following error appears:

$ symfony console cache:clear

 [WARNING] Some commands could not be registered:                                                                       

In XmlDriver.php line 1006:

  Warning: DOMDocument::schemaValidate(): Invalid Schema

When I go to that line, it shows:

try {
    $document = new DOMDocument();
    $document->load($file);

    if (! $document->schemaValidate(__DIR__ . '/../../../../../doctrine-mapping.xsd')) {
        throw MappingException::fromLibXmlErrors(libxml_get_errors());
    }

    ...
}

When I dump the value of $file, it shows [...]/vendor/friendsofsymfony/user-bundle/Resources/config/doctrine-mapping/User.orm.xml, as if that file is not a valid mapping file. Symfony didn't complain about this while I was still on version PHP 7.4.

Obviously the recommended approach is to move away from this library, but maybe someone knows a quick fix for this. Quite possible that this error is more related to Doctrine than to this bundle, but decided to ask here first.

yard-mschwartz commented 7 months ago

As of now, it appears to be a problem that comes up with libxml 2.12 introduced by modern PHP-versions: https://github.com/doctrine/orm/issues/11117

stof commented 6 months ago

Closing this in favor of the doctrine/orm issue as this is not a bug in FOSUserBundle but an issue in the Doctrine ORM XSD schema itself.