symfony2 "Erroneous data format for unserializing user entity" (FOS UserBundle) - php

I develop in symfony2 but am no sym2 wiz, brought in help to set everything up with the framework, and now it's throwing me a sudden error message I can't resolve.
I have two development environments, and one that I hadn't been using for a couple of months suddenly hit me with this error message upon trying to log in to my sym2 webapp locally:
"Erroneous data format for unserializing [user entity]"
I have not changed the code for logging in, I have not updated my vendors, and I have not changed any settings in MAMP (could it have updated itself though and done that?)
I don't understand what is going on.
I can google the error and I am suggested to hack one of the vendor source files. I would not know exactly what I would have done, so I am not comfortable with doing that just following some step-by-step instruction.
The application is running on symfony 2.3.9 and MAMP is set to PHP 5.6.27, the other option is 7.0.12 which produces the same error.

Ok, I changed my doctrine version to
"doctrine/orm": "~2.2,>=2.2.3,<2.5",
and it resolved the issue. Now I don't know what other issues THAT might have introduced seeing sym2 isn't always too backwards compatible, but fingers crossed =)

Related

Error when first launching symfony 4 project

I want to use Symfony 4.x for a new project, I have installed composer and used it to create a new project. My php version is 7.0.10 & I have wamp as well.
In this tutorial (https://symfony.com/doc/master/setup.html), it says after you run the server "Open your browser and navigate to http://localhost:8000/". When I do so, I get a No route found for "GET /" error.
the pictures bellow display what I get as an error more precisely :
as well as
I have installed everything following the guide on their official page. I have seen this problem being discussed on github (https://github.com/symfony/symfony-docs/issues/9178) but I don't understand their "quick fix" nor what they're talking about.
I want to know how to get my project running without that problem.
Thanks for any help
It’s strange but It’s totally normal and the error proved that Symfony is well installed
It’s not a « compile » or « configuration » error it’s just a logical error that means you don’t have route defined at
url / so keep learning and define a route (see doc and you see the result)

Symfony Web Profiler not working

Yesterday my Web Profiler stopped working, in Symfony v.3.0.9 (on Win, with WAMP, PHP v7.0.4). Before that it worked just fine and I'm not sure exactly what happened when it stopped.
I first checked the JS errors being reported, then possible errors in dev.log, then tried clearing the cache (with cache:clear), also as an admin and also manually in file system. Nothing helped.
There are no errors returned anywhere and there are no tries from client side to even call it with AJAX. I tried restarting Apache, Wamp & Windows.
Then, I tried composer update, which naturally brought up some new, unrelated issues, and eventually I ended up installing Symfony 3.1, but still no sign of Profiler.
My HTML page does have a body, so the solution here: Web Profiler not showing up in dev doesn't help me. All other mentions of this problem usually lead to some compiling issue, which I don't have (or didn't find it yet).
I also made sure I am running in dev mode, by putting breakpoints in app_dev.php directly.
Has anyone any other/new idea what could be going on?
Addition: I also tried updating Symfony to 3.2, without Profiler appearing.
Addition #2: Just wanted to share, that the only way I can get my Web Profiler to show is, after the cache is rebuilt, go into the var/cache/dev/appDevDebugProjectContainer.php, into the getProfilerService() function and manually comment out the line with:
$instance->disable();
Ugly as hell, but I haven't find any other solution until now. At least, now I see that somehow Symfony decides, based on some internal logic, to actually not show the profiler. At least there is some logic at works.
The final answer to my "mysterious" issue was that someone in the team changed the profiler's setting in the config_dev.yml, and set the:
framework:
profiler:
collect: false
Getting that back to collect:true (which is also its default value) made it all work.

"Access Denied Code 5" PHP Rename Error in Symfony2/Doctrine2

I am getting the infamous Doctrine "PHP Rename Access Denied Code 5" error in my Symfony2 project when logging in using the User entity:
\\app\\cache\\dev/doctrine/orm/Proxies\\__CG__AcmeDemoBundleEntityUser.php): Access is denied. (code: 5)
I will log in OK, and if I am lucky, I can load a page before the session is killed as a result of the user authentication failing as a result of this error. It only happens with this one entity.
My colleague, with the same set up and same project has the same error but for a different entity (and ONLY that entity).
This problem has been reported on here before, with a link to the bug on Doctrine's GitHub which was confirmed fixed as of 2.5 (confirmed in Doctrine ORM 2.5 Release Notes).
My Symfony2 project is running with Doctrine ORM 2.5.4 yet I am still getting the same error.
Attempted Fixes
Reinstall XAMPP;
Deleted project & pulled project from git;
Updated vendor projects (maybe an old Doctrine ORM package remained);
Closing PHPStorm (maybe it's locking the files for indexing);
Disabled Windows indexing (same reason as above).
Changing the value of auto_generate_proxy_classes from %kernel.debug% to false in config_dev.yml prevents the problem, but this hides the issue instead of fixing it.
Has anyone managed to actually fix this?
Have you tried to set up auto_generate_proxy_classes to a underlying constant value for AbstractProxyFactory::AUTOGENERATE_EVAL or AbstractProxyFactory::AUTOGENERATE_FILE_NOT_EXISTS.
According to this documentation section Advanced Configuration > Auto-generating Proxy Classes this should fix the access denied problem in development environment.
Also, you should make sure your production configuration follows this recommendation:
In a production environment, it is highly recommended to use AUTOGENERATE_NEVER to allow for optimal performances. The other options are interesting in development environment.

Symfony 2.5.3 and PHP 5.6.0: incompatibility issues?

I don't know if this is a Symfony issue or a FOSUserBundle issue so I'll report here and hope get some help. I have two development instances:
CentOS 6.5, PHP 5.5.16, MySQL 5.5.37
CentOS 7, PHP 5.6.0, MariaDB 5.5.37
I tried the same project in both instances and by same project I mean the same: copied without any vendor and in both instances run "composer update" at first. After composer updates the vendor I tried to access admin area, which is handled by, FOSUserBundle and surprise in the first instance it works without any problem but in the second one it does not work and I get this error:
Error! Warning: Erroneous data format for unserializing
'Tanane\UserBundle\Entity\User' in
/var/www/html/tanane/vendor/doctrine/orm/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php
line 872
Can any give me some advice around this? Is a Symfony bug or a FOSUserBundle bug? Or it's other thing and I don't see it?
Yes, this is a known problem, though it's not in FOSUserBundle. This problem is caused by Doctrine 2, the deserialization is broken there on creating a ClassMetadataInfo.
However, fixing this problem involves introducing some incompatibilities in Doctrine's architecture, so this won't be fixed until Doctrine 2.5 release at least.
Currently, the options are to switch back to PHP 5.5 or less or use a master version of Doctrine (the pull request fixing this does not seem to be tagged yet)
See this Doctrine Jira ticket for more info.

Trouble with HMVC modular extensions for CodeIgniter

I've been developing locally on MacOS X Snow Leopard using PHP 5.3, CodeIgniter 2.0 and HMVC Modular Extensions. Everything has been working great.
Suddenly, for no reason I can pinpoint, I am occasionally getting this error when trying to bring up a page:
Unable to select the specified
database: app Filename:
/Library/WebServer/Documents/www/development/appdb/third_party/MX/Loader.php
Line Number: 96
The error doesn't occur at any specific place, it just seems to appear every 5-10 page loads or so. It usually goes away after a refresh, although sometimes I may need to refresh a couple of times.
Has anyone encountered this error before? Is it just some flakiness in mySQL on my Mac? (I also tried exporting the current DB and re-importing it under a different name and assigning that new DB, but the problem persists. I don't know of a way to test and "repair" a MySQL DB on a Mac.)
Thanks in advance for any help!
Gary
This is just an issue with your MySQL database. While I'm not sure what that issue is, HMVC has nothing to do with it.
The error comes from there as the loader is extended by HMVC, but no logic is changed. I'd fix up your database or install MAMP.

Categories