I have an error when i execute this command :
php app/console cache:clear --env=prod && php app/console cache:clear --env=dev && php app/console assets:install --symlink && php app/console assetic:dump
The error is :
[Symfony\Component\Debug\Exception\ContextErrorException] Catchable
Fatal Error: Argument 1 passed to
Sonata\AdminBundle\Security\Handler\RoleSecurityHandler::__construct()
must implement interface
Symfony\Component\Security\Core\SecurityContextInter face, null
given, called in
/opt/preprod/app/cache/pro_/ap_ProdProjectContainer.php on line 1923
and defined
Can you help i dont really know how to fix this
EDIT
I tried to backup
composer.lock
and
vendor
directory (and then delete them). Then i deleted mannually the cache.
Then i made a composer install but the error is back when i made the composer install.
Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache
[Symfony\Component\Debug\Exception\ContextErrorException]
Catchable Fatal Error: Argument 1 passed to Sonata\AdminBundle\Security\Handler\RoleSecurityHandler::__construct() must implement interface Symfony\Component\Security\Core\SecurityContextInterface, null given, called in /opt/preprod/app/cache/dev/appDevDebugProjectContainer.php on line 4984 and defined
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-install-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
php app/check.php give me everything is ok
So i dont find the way to solve this
What version of Symfony are you using? I would guess 2.8 or 3.0 since it looks like the version of SonataAdminBundle is not compatible with your Symfony version.
Related
i have a git symfony project i want to work localy , after clone and composer install, i have this error : Uncaught PHP Exception ReflectionException: "Class "App\Entity\Site" does not exist" but this class is from an other project.
As mentioned in other topics as this one or this one, i cleared cache with php bin/console cache:clear php bin/console cache:warmup symfony console cache:clear ...
I tried to access to the website with symfony server:start and from xampp, same result.
I also tried to launch php server with php -S localhost:8000 -t public/.
Same result, it looks like it remains some caches somewhere i dont know ?
I'm tried to create a new Symfony project with the standard procedure "symfony new my_project_name --full". If I try to access a defined route "/test" I'm getting the following Exception:
REQUES Uncaught PHP Exception ReflectionException: "Class App\Entity\Provider does not exist" at C:\xampp\htdocs\Sauber\template\vendor\doctrine\persistence\lib\Doctrine\Persistence\Mapping\Driver\AnnotationDriver.php line 179
The Class App\Entity\Provider is an entity from another project and isn't defined anywhere in the new project and I just don't unserstand where this is coming from.
I had the same problem and solved it warming the cache for the environment as in this link:
Symfony - How to solve the doctrine issue of the missing annotations?.
Basically:
php bin/console cache:clear
php bin/console cache:warmup
As carlam.14 mentioned, running cache:clear may solve it for you. For me running it through the symfony CLI tool was what finally fixed this for me:
symfony console cache:clear
symfony console cache:warmup
I get a project by command-line git clone on bitbucket.
I run php ../composer.phar install and I had after installing all these dependencies the following error:
Executing script cache:clear [KO] [KO] Script cache:clear returned
with error code 255 !! !! Warning: require(... PHP Fatal error:
require(): Failed opening required
'C:\xampp\htdocs\aksymfony4\myProjetSf4\vendor\composer/../symfony/validator/Resources/functions/dump.php'
(include_path='C:\xampp\php\PEAR')
How fix this error?
Thanks
I use:
Xampp v3.2.4,
Symfony 4.4,
php: 7.3.15
Try run the installation by administrator powershell.
And does those file exist or not, if not try install again,
or go to the dependency of github to download
when i try to run php artisan i give the error
[Error Exception]
Undefined offset: 0
when i run composer install or composer update i got this error
Script php artisan clear-compiled handling the post-install-cmd event returned with an error
[RuntimeException]
Error Output:
i install all extensions, run composer dumpautoload but i still get this error. the problem is in this current procjet(i created another laravel project and it works fine)
finally i found out that in service provider, in boot method, there was db query which returned false, so array(where i put db query result) with index 0 doesnt exist
$result[0]->title // <---doesnt exist($result is empty)
When trying to clear the cache on my symfony2 project, I am getting this error message:
PHP Fatal error: Call to undefined method Symfony\Component\Console\Output\ConsoleOutput::isVerbose() in /var/staging_www/www.sciforum.net/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php on line 87
Any idea? Thank you.
EDIT:
When trying to update vendors, I am getting this error message:
Clearing the cache for the dev environment with debug true
PHP Fatal error: Call to undefined method Symfony\Component\Console\Output\ConsoleOutput::isVerbose() in /var/staging_www/www.sciforum.net/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Command/CacheClearCommand.php on line 99
Script Sensio\Bundle\DistributionBundle\Composer\ScriptHandler::clearCache handling the post-update-cmd event terminated with an exception
[RuntimeException]
An error occurred when executing the "'cache:clear --no-warmup'" command.
Check your versions in composer.json (and double-check versions for Symfony-based libraries in composer.lock). isVerbose only became available in ConsoleOutput with version 2.4.
You may have some mixed versions of the Symfony libraries.
You can fixit if you delete the directories first:
sudo rm -rf app/logs
sudo rm -rf app/cache
I've had a similar problem. Disabling PHP opcache for CLI helped me.
Disable it in php.ini:
opcache.enable_cli=0
Save the file and try clearing the cache again.