Ich arbeite an einem symfony2-Projekt mit mongodb odm und versuche, sonata-admin einzurichten.Symfony2/SonataAdmin: Beim Versuch, einen Datensatz zu aktualisieren, wurde ein CSRF-Fehler gemeldet
Ich konnte:
- Setup-Sonate auf 2 Arten von ODM Dokumente
- Liste
Aber wenn ich einen Datensatz zu aktualisieren bin versucht, ich habe zur Zeit ein Problem CSRF. Ich versuchte für beide Arten von Aufzeichnungen.
An error has occurred during update of item "AppBundle\Document\Domain:0000000013e9983500007fbae117c6a0".
The CSRF token is invalid. Please try to resubmit the form.
Es scheint, die CSRF-Token im Quellcode vorliegt:
<input type="hidden" id="s57a195b9a533f__token" name="s57a195b9a533f[_token]" class=" form-control" value="W-pG62dT7hn6mHUu15bQQ4ChU0P55w9pmXsfP7HDnQE" />
ich Apache verwende. Das Umschreibmodul ist aktiviert.
Hier ist mein Setup:
Sonata Bundles
[email protected]:/var/www/publishr$ php composer.phar show sonata-project/*
sonata-project/admin-bundle 3.x-dev 7386ec0 The missing Symfony Admin Generator
sonata-project/block-bundle 3.1.1 Symfony SonataBlockBundle
sonata-project/cache 1.0.7 Cache library
sonata-project/core-bundle 3.0.3 Symfony SonataCoreBundle
sonata-project/doctrine-mongodb-admin-bundle 3.x-dev 1157efc Symfony Sonata/Integrate Doctrine MongoDB ODM into the Son...
sonata-project/exporter 1.6.0 Lightweight Exporter library
Symfony Bundles
[email protected]:/var/www/publishr$ php composer.phar show symfony/*
symfony/assetic-bundle v2.8.0 Integrates Assetic into Symfony2
symfony/monolog-bundle 2.11.1 Symfony MonologBundle
symfony/phpunit-bridge v3.1.3 Symfony PHPUnit Bridge
symfony/polyfill-apcu v1.2.0 Symfony polyfill backporting apcu_* functions to lower PHP versions
symfony/polyfill-intl-icu v1.2.0 Symfony polyfill for intl's ICU-related data and classes
symfony/polyfill-mbstring v1.2.0 Symfony polyfill for the Mbstring extension
symfony/polyfill-php56 v1.2.0 Symfony polyfill backporting some PHP 5.6+ features to lower PHP versions
symfony/polyfill-php70 v1.2.0 Symfony polyfill backporting some PHP 7.0+ features to lower PHP versions
symfony/polyfill-util v1.2.0 Symfony utilities for portability of PHP codes
symfony/security-acl v3.0.0 Symfony Security Component - ACL (Access Control List)
symfony/swiftmailer-bundle v2.3.11 Symfony SwiftmailerBundle
symfony/symfony v3.1.3 The Symfony PHP framework
PHP Version
[email protected]:/var/www/publishr$ php -v
PHP 5.6.23-1+deprecated+dontuse+deb.sury.org~trusty+1 (cli)
Copyright (c) 1997-2016 The PHP Group
Zend Engine v2.6.0, Copyright (c) 1998-2016 Zend Technologies
with Zend OPcache v7.0.6-dev, Copyright (c) 1999-2016, by Zend Technologies
Wenn ich in FormTypeCsrfExtension.php die "defaultEnabled" auf false deaktiviert. Der Datensatz wird aktualisiert. –
Ja, aber dann haben Sie keinen Schutz mehr vor CSRF – greg0ire
Sie sollten versuchen, Schritt für Schritt zu debuggen in 'vendor/symfony/Symfony/src/Symfony/Komponente/Formular/Erweiterung/Csrf/EventListener/CsrfValidationListener.php' – greg0ire