assetic:watch error - unserialize(): Error at offset - symfony

I was using everyday assetic in work (OS: Win7) but today i was runned command: php bin/console assetic:watch and get this error:
[Symfony\Component\Debug\Exception\ContextErrorException] Notice: unserialize(): Error at offset 0 of 25228 bytes
I was try clear cache - don't help.
I not delete any file and in repository that file not exist and this project is on 3 machines (don't have access now only to 1) and everywhere it works...
Nothing was updated or installed to project so far as i know.

So helped delete all files with prefix assetic_watch_* in %LOCALAPPDATA%\Temp\

bin/console assetic:watch --force also cleared for me.

Related

Symfony 4 - php bin/console server:run not works

I have a problem with this command : php bin/console server:run on Symfony 4
When I go to http://127.0.0.1:8000/ I have this error message :
Warning: Unknown: failed to open stream: No such file or directory in Unknown on line 0
Fatal error: Unknown: Failed opening required 'J:\my_project\vendor\symfony\web-server-bundle/Resources/router.php' (include_path='.;C:\php\pear') in Unknown on line 0
Indeed, the router.php file does not exist !
But if I run this command : php -S 127.0.0.1:8000 -t public everything is ok.
Any idea ?
First check that you have installed the SF4 Web Server bundle :
> composer require server --dev
then you can start using it through Symfony using run / start command
Not sure if this is the case for you too, but it is probably worth checking (and may also be interesting for others having the same problem).
My antivirus software likes to put the router.php in quarantine (effectively removing it from that directory). Check if yours did the same and if so restore it and create an exception for that file. Additionally you should configure your antivirus to notify you if it puts something in quarantine, so you can intervene in time.

Please help me debug this error message I get at the console

When I run this command php app/console translation:update es GWDAdminBundle --force --prefix="__" at the terminal I get the following error message:
[Twig_Error_Syntax]
Unexpected token "name" of value "View" ("end of print statement" expected) at line 31
I don't which file is throwing this error, when I look at the log there is nothing remotely close to this, I suspect that it is one of my view files but how do I begin looking? Any ideas?
Many thanks to kix! I was able to debug all of my twig files with the following command:
php app/console twig:lint src/

Symfony project Installation

I am trying to install Symfony inside my project folder by using this command: composer create-project symfony/framework-standard-edition path/ "2.5.*".
During the set up I get prompted with a question if I want to install Aceme demo bundle which I reply to with yes, the installation continues but I get prompted again with these questions "look at the image":
As you can see I filled in all the details but this throws set of errors:
[Symfony\Component\Debug\Exception\ContextErrorException]
Warning: date_default_timezone_get(): It is not safe to rely on the system's
timezone settings. You are *required* to use the date.timezone setting or the
date_default_timezone_set() function. In case you used any of those methods
and you are still getting this warning, you most likely misspelled the timezone
identifier. We selected the timezone 'UTC' for now, but please set date.timezone
to select your timezone. in
/Applications/MAMP/htdocs/Symfony/Project1/vendor/monolog/monolog/src/Monolog/Logger.php line 233
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. `
What am I doing wrong here?
Perhaps a downside of using composer to create the project, you don't have a chance to go through the "Checking your System Configuration" section of the installation and fix errors before proceeding.
https://github.com/symfony/symfony-standard/tree/2.5#2-checking-your-system-configuration
If you run php app/check.php you'll see that you haven't met one of the mandatory requirements, which is to explicitly setting the date.timezone value in your system's php.ini
I found the problem why the error was thrown xD
It was due to my php version I had installed on my mac (5.3)
Symfony requiers 5.5
Since I updated my version I dont see this error any more.
Thanks for yours help guys :)

Symfony2 Bootstrap.php.cache

I'm developing in Ubuntu 14 and I get the following error when creating a databaes:
$ php app/console doctrine:database:create
This is the error output:
PHP Warning: require_once(/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache):
failed to open stream: No such file or directory in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
PHP Fatal error: require_once(): Failed opening required
'/home/jesse/playground/www/symfony/htdocs/app/bootstrap.php.cache'
(include_path='.:/usr/share/php:/usr/share/pear') in
/home/jesse/playground/www/symfony/htdocs/app/console on line 10
What Ive Tried
Running this in Vagrant
Running this Locally
This is one among several problem running Symfony2 under Ubuntu, the other forcing you to implement umask(0000) otherwise you have to get chmod +a permissions for log and cache folders, this seems like a bit of a hassle for something seemingly simple.
Does anyone know what to work around this error?
This should do the trick:
php /home/jesse/playground/www/symfony/htdocs/vendor/sensio/distribution-bundle/Sensio/Bundle/DistributionBundle/Resources/bin/build_bootstrap.php

stange error with Behat and Mink on Sf2

I'm using Behat,mink in my Symfony2 project,so I follow those tutorials to make installation :
http://extensions.behat.org/symfony2/ , http://extensions.behat.org/symfony2/migrating_from_2.3_to_2.4.html
but when I run this command php behat.phar --init "#YouBundleName",I get this very strange error :
PHP Warning: require(Behat\MinkExtension\Extension): failed to open stream: No such file or directory in phar:///var/www/project/behat.phar/src/Behat/Behat /Extension/ExtensionManager.php on line 112
PHP Fatal error: require(): Failed opening required 'Behat\MinkExtension\Extension' (include_path='.:/usr/share/php:/usr/share/pear') in phar:///var/www/project/behat.phar/src/Behat/Behat/Extension/ExtensionManager.php on line 112
I'm sure I installed the last version of behat and mink mentionned in the second link above and then I made php composer.phar unpdate and cache clear too,but still the same error?
I had the same problem. Forgot you need to install behat/mink-extension as well as behat/mink. For example you might need to run:
php composer.phar require behat/mink-extension:*
Worked for me.
By the way, looks like you got confused by the two installation methods, phar vs composer. I'd go with the composer route because it's easier to update and manage versions. This would mean running php bin/behat ... instead of php behat.phar ....

Resources