symfony / security-acl

Symfony Security ACL Component
https://symfony.com/components/Security
MIT License
362 stars 50 forks source link

Usage of unsigned integer in table creation: ACL schema is not recognized by doctrine:schema:validate #44

Open smilearric opened 5 years ago

smilearric commented 5 years ago

Hello,

I am getting the exact same problem as the one described here:

https://github.com/symfony/symfony/issues/5108

It has been working fine until I ran composer update today. But now:

$ bin/console doctrine:schema:validate

Mapping
-------

 [OK] The mapping files are correct.

Database
--------

 [ERROR] The database schema is not in sync with the current mapping file.

$ bin/console doctrine:schema:update --force --dump-sql

 The following SQL statements will be executed:

     ALTER TABLE acl_classes CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL;
     ALTER TABLE acl_security_identities CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL;
     ALTER TABLE acl_object_identities CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL;
     ALTER TABLE acl_entries CHANGE id id INT UNSIGNED AUTO_INCREMENT NOT NULL;

 Updating database schema...

     4 queries were executed

 [OK] Database schema updated successfully!

Playing those two command another time each will result in the same output.

I found that the current security-acl bundle actually implements the same specific unsigned integer in its https://github.com/symfony/security-acl/blob/master/Dbal/Schema.php which were causing https://github.com/symfony/symfony/issues/5108 and were removed in https://github.com/daFish/symfony/commit/57694aaa94ec0118f516e8962be2f018c36d2011 and which led to a merge by FabPot back... in 2012.

Dropping / recreating the DB as well as a fresh composer install did not fix the problem.

More details:

Running within Laragon for Windows 7 with:

DB encoding is utf8_unicode_ci. Tried encoding latin1_swedish_ci with the same issue.

Updating dependencies (including require-dev)
    Finished: success: 0, skipped: 0, failure: 75, total: 75
Package operations: 93 installs, 0 updates, 0 removals
  - Installing symfony/polyfill-ctype (v1.10.0): Downloading (100%)
  - Installing symfony/polyfill-mbstring (v1.10.0): Downloading (100%)
  - Installing twig/twig (v2.5.0): Downloading (100%)
  - Installing paragonie/random_compat (v2.0.17): Downloading (100%)
  - Installing symfony/polyfill-php70 (v1.10.0): Downloading (100%)
  - Installing symfony/polyfill-util (v1.10.0): Downloading (100%)
  - Installing symfony/polyfill-php56 (v1.10.0): Downloading (100%)
  - Installing symfony/symfony (v3.4.19): Loading from cache
  - Installing symfony/polyfill-intl-icu (v1.10.0): Downloading (100%)
  - Installing symfony/polyfill-apcu (v1.10.0): Downloading (100%)
  - Installing psr/simple-cache (1.0.1): Downloading (100%)
  - Installing psr/log (1.1.0): Downloading (100%)
  - Installing psr/link (1.0.0): Downloading (100%)
  - Installing psr/container (1.0.0): Downloading (100%)
  - Installing psr/cache (1.0.1): Downloading (100%)
  - Installing fig/link-util (1.0.0): Downloading (100%)
  - Installing doctrine/lexer (v1.0.1): Downloading (100%)
  - Installing doctrine/annotations (v1.6.0): Downloading (100%)
  - Installing doctrine/reflection (v1.0.0): Downloading (100%)
  - Installing doctrine/event-manager (v1.0.0): Downloading (100%)
  - Installing doctrine/collections (v1.5.0): Downloading (100%)
  - Installing doctrine/cache (v1.8.0): Downloading (100%)
  - Installing doctrine/persistence (v1.1.0): Downloading (100%)
  - Installing doctrine/inflector (v1.3.0): Downloading (100%)
  - Installing doctrine/common (v2.10.0): Downloading (100%)
  - Installing symfony/security-acl (v3.0.1): Downloading (100%)
  - Installing ajgl/csv-rfc (0.1.0): Downloading (100%)
  - Installing ajgl/csv (0.4.0): Downloading (100%)
  - Installing ajgl/csv-bundle (dev-master a6b4873): Cloning a6b487335b from cache
  - Installing friendsofsymfony/ckeditor-bundle (1.1.0): Downloading (100%)
  - Installing monolog/monolog (1.24.0): Loading from cache
  - Installing symfony/monolog-bundle (v3.3.1): Loading from cache
  - Installing sensio/framework-extra-bundle (v5.2.2): Downloading (100%)
  - Installing composer/ca-bundle (1.1.3): Loading from cache
  - Installing sensiolabs/security-checker (v5.0.1): Loading from cache
  - Installing sensio/distribution-bundle (v5.0.23): Loading from cache
  - Installing ramsey/uuid (3.8.0): Loading from cache
  - Installing chadsikorra/php-simple-enum (1.0.0): Loading from cache
  - Installing ldaptools/ldaptools (v0.25.2): Loading from cache
  - Installing ldaptools/ldaptools-bundle (0.9.2): Loading from cache
  - Installing incenteev/composer-parameter-handler (v2.1.3): Loading from cache
  - Installing doctrine/instantiator (1.1.0): Loading from cache
  - Installing doctrine/dbal (v2.9.0): Downloading (100%)
  - Installing doctrine/orm (v2.6.3): Loading from cache
  - Installing doctrine/doctrine-cache-bundle (1.3.5): Loading from cache
  - Installing jdorn/sql-formatter (v1.2.17): Loading from cache
  - Installing doctrine/doctrine-bundle (1.10.0): Downloading (100%)
  - Installing maix-si/connexion (0.6.3): Cloning f1f6a70c31 from cache
  - Installing sonata-project/exporter (1.9.1): Downloading (100%)
  - Installing twig/extensions (v1.5.4): Downloading (100%)
  - Installing sonata-project/datagrid-bundle (2.4.0): Downloading (100%)
  - Installing cocur/slugify (v3.1): Downloading (100%)
  - Installing sonata-project/core-bundle (3.11.2): Downloading (100%)
  - Installing sonata-project/cache (2.0.1): Downloading (100%)
  - Installing sonata-project/block-bundle (3.12.1): Downloading (100%)
  - Installing knplabs/knp-menu (2.3.0): Downloading (100%)
  - Installing knplabs/knp-menu-bundle (v2.2.1): Downloading (100%)
  - Installing sonata-project/admin-bundle (3.38.3): Downloading (100%)
  - Installing sonata-project/doctrine-orm-admin-bundle (3.6.1): Downloading (100%)
  - Installing michelf/php-markdown (1.8.0): Downloading (100%)
  - Installing knplabs/knp-markdown-bundle (1.7.0): Downloading (100%)
  - Installing egeloen/json-builder (3.0.0): Downloading (100%)
  - Installing egeloen/ckeditor-bundle (6.0.1): Downloading (100%)
  - Installing sonata-project/formatter-bundle (3.5.0): Downloading (100%)
  - Installing sonata-project/intl-bundle (2.5.0): Downloading (100%)
  - Installing sonata-project/easy-extends-bundle (2.5.0): Downloading (100%)
  - Installing sonata-project/doctrine-extensions (1.1.2): Downloading (100%)
  - Installing ralouphie/getallheaders (2.0.5): Loading from cache
  - Installing psr/http-message (1.0.1): Downloading (100%)
  - Installing guzzlehttp/psr7 (1.5.2): Downloading (100%)
  - Installing kriswallsmith/buzz (v0.16.1): Downloading (100%)
  - Installing knplabs/gaufrette (v0.6.0): Downloading (100%)
  - Installing phpoption/phpoption (1.5.0): Downloading (100%)
  - Installing phpcollection/phpcollection (0.5.0): Downloading (100%)
  - Installing jms/parser-lib (1.0.0): Downloading (100%)
  - Installing jms/metadata (1.7.0): Downloading (100%)
  - Installing jms/serializer (1.13.0): Downloading (100%)
  - Installing jms/serializer-bundle (2.4.2): Downloading (100%)
  - Installing imagine/imagine (v0.7.1): Downloading (100%)
  - Installing symfony/phpunit-bridge (v3.4.19): Downloading (100%)
  - Installing sonata-project/media-bundle (3.15.0): Downloading (100%)
  - Installing zendframework/zenddiagnostics (v1.3.1): Downloading (100%)
  - Installing sonata-project/notification-bundle (3.5.1): Downloading (100%)
  - Installing swiftmailer/swiftmailer (v5.4.12): Downloading (100%)
  - Installing friendsofsymfony/user-bundle (v2.1.2): Downloading (100%)
  - Installing sonata-project/user-bundle (4.2.3): Downloading (100%)
  - Installing symfony/acl-bundle (v1.0.0): Downloading (100%)
  - Installing symfony/swiftmailer-bundle (v2.6.7): Downloading (100%)
  - Installing sensio/generator-bundle (v3.1.7): Downloading (100%)
  - Installing doctrine/data-fixtures (v1.3.1): Downloading (100%)
  - Installing doctrine/doctrine-fixtures-bundle (3.0.4): Downloading (100%)
  - Installing willdurand/jsonp-callback-validator (v1.1.0): Downloading (100%)
  - Installing friendsofsymfony/jsrouting-bundle (2.2.2): Loading from cache

(...suggestions)

Writing lock file
Generating autoload files
> Incenteev\ParameterHandler\ScriptHandler::buildParameters
Updating the "app/config/parameters.yml" file
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::buildBootstrap
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache

 // Clearing the cache for the dev environment with debug
 // true

 [OK] Cache for the "dev" environment (debug=true) was successfully cleared.

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installAssets

 Trying to install assets as relative symbolic links.

(...copy)

 [OK] All assets were successfully installed.

> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::installRequirementsFile
> Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::prepareDeploymentTarget

My composer.json might help:

{
    "name": "name",
    "license": "license",
    "type": "project",
    "description": "description",
    "autoload": {
        "psr-4": {
            "AppBundle\\": "src/AppBundle",
            "Application\\Sonata\\": "src/Application/Sonata"
        },
        "classmap": [ "app/AppKernel.php", "app/AppCache.php" ]
    },
    "autoload-dev": {
        "psr-4": { "Tests\\": "tests/" },
        "files": [ "vendor/symfony/symfony/src/Symfony/Component/VarDumper/Resources/functions/dump.php" ]
    },
    "require": {
        "php": ">=5.5.9",
        "ext-json": "*",
        "ext-mbstring": "*",
        "ajgl/csv-bundle": "dev-master as 0.5.x-dev",
        "doctrine/doctrine-bundle": "^1.6",
        "doctrine/doctrine-fixtures-bundle": "^3.0",
        "doctrine/orm": "^2.5",
        "friendsofsymfony/ckeditor-bundle": "1.1",
        "friendsofsymfony/jsrouting-bundle": "^2.2",
        "incenteev/composer-parameter-handler": "^2.0",
        "owner/project": "0.6.3",
        "sensio/distribution-bundle": "^5.0.19",
        "sensio/framework-extra-bundle": "^5.0.0",
        "sonata-project/admin-bundle": "3.38.3",
        "sonata-project/block-bundle": "3.12.1",
        "sonata-project/core-bundle": "3.11.2",
        "sonata-project/doctrine-orm-admin-bundle": "3.6.1",
        "sonata-project/easy-extends-bundle": "2.5.0",
        "sonata-project/formatter-bundle": "3.5.0",
        "sonata-project/intl-bundle": "2.5.0",
        "sonata-project/media-bundle": "3.15.0",
        "sonata-project/notification-bundle": "3.5.1",
        "sonata-project/user-bundle": "4.2.3",
        "symfony/acl-bundle": "1.0",
        "symfony/monolog-bundle": "^3.1.0",
        "symfony/polyfill-apcu": "^1.0",
        "symfony/swiftmailer-bundle": "^2.6.4",
        "symfony/symfony": "3.4.*",
        "twig/twig": "^1.0||^2.0"
    },
    "require-dev": {
        "sensio/generator-bundle": "^3.0",
        "symfony/phpunit-bridge": "^3.0"
    },
    "scripts": {
        "symfony-scripts": [
            "Incenteev\\ParameterHandler\\ScriptHandler::buildParameters",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::buildBootstrap",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::clearCache",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installAssets",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::installRequirementsFile",
            "Sensio\\Bundle\\DistributionBundle\\Composer\\ScriptHandler::prepareDeploymentTarget"
        ],
        "post-install-cmd": [
            "@symfony-scripts"
        ],
        "post-update-cmd": [
            "@symfony-scripts"
        ]
    },
    "config": {
        "platform": {
            "php": "7.2"
        },
        "sort-packages": true
    },
    "extra": {
        "symfony-app-dir": "app",
        "symfony-bin-dir": "bin",
        "symfony-var-dir": "var",
        "symfony-web-dir": "web",
        "symfony-tests-dir": "tests",
        "symfony-assets-install": "relative",
        "incenteev-parameters": {
            "file": "app/config/parameters.yml"
        },
        "branch-alias": {
            "dev-master": "3.4-dev"
        }
    },
    "repositories": [
        {
          "type": "git",
          "url": "git@bitbucket.org:owner/project.git"
        }
    ]
}

I cannot tell if this has any effect on ACL since I have not yet implemented it.

Anything to do?

Regards

yakobe commented 5 years ago

I also have this issue. It's is playing havoc with our migration scripts. Is there any way we can help?

yakobe commented 5 years ago

@smilearric do you have any further info about this issue?

@javiereguiluz could you let us know if this issue is logged in the right place so that we can help as much as possible?

javiereguiluz commented 5 years ago

@yakobe if you are asking if this is the right repo to report this error ... then you are right. The "Symfony ACL" was taken out of the main symfony/symfony repo, so issues must be reported here. Thanks!

smilearric commented 5 years ago

@yakobe How could I help? What would you like to know?

I'm currently on a different project for a few weeks. Since I lose access to the sources in the meanwhile I won't be able to tell you quickly the versions I was running before the issue appeared, if that's what you're after. Otherwise let me know.

yakobe commented 5 years ago

@javiereguiluz thanks for getting back.

It seems that making the same changes as https://github.com/daFish/symfony/commit/57694aaa94ec0118f516e8962be2f018c36d2011 does not help. The tables still show changes, just without the "unsigned". It would also make sense since this library was not updated and has not changed in a long time.

After some investigation and comparing packages that both I and @smilearric updated, the break seems to occur after updating doctrine/dbal from v2.8.1 to v2.9.0. The question is, what does symfony/security-acl implement that is not compatible by the changes in https://github.com/doctrine/dbal/compare/v2.8.1..v2.9.0?

quisse commented 5 years ago

I'm also running into this. Edit: https://github.com/symfony/security-acl/commit/e610abf4fc1f1492a4d8f345eaea3bf94fec3818 seems to solve it

mauriau commented 5 years ago

I install the dev-master version of this bundle. now it's works.