JMS Call to a member function has() on null - symfony

Bundle version 1.3.1
| Symfony version 3.3
| PHP version 7.1.9
Expected behavior
After installing the different bundles (JMSTranslationBundle, JMSDIExtraBundle, checking if i had sensio/framework-extra-bundle), and after i made the right configuration in config.yml and routing_dev.yml, the right behavior should be that the /_trans lead me to a translation interface (working), and change nothing else.
Actual behavior
Getting on a route different from /_trans return Call to a member function has() on null with error 500. Therefore, the whole site is dead, except the translation UI.
Steps to reproduce
Install JMSTranslationBundle, then when asked, install JMSDIExtraBundle to get the web ui
After that, test the /_trans. This should work. But when you get to your others routes, they return 500 error

I have exactly the same issue (Sf 3.3.9/PHP 7.1.9). I have to remove the line related to "JMSDiExtraBundle" in AppKernel to make my app works again. This is the only workaround I found, not very efficient.
Very low trace log information, this is what I have:
Stack Trace:
Logs:
CRITICAL 19:56:59 php Call to a member function has() on null
CRITICAL 19:56:59 request Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function has() on null" at /Users/stephanfo/PhpstormProjects/openbuy/vendor/symfony/symfony/src/Symfony/Bundle/FrameworkBundle/Controller/ControllerTrait.php line 233
Exception:
Any help would be helpful.
Thanks,
Stef.

Related

Fatal error: Uncaught Error: Call to a member function query() on null after upgrading to PHP 8.0

One of my older WordPress websites got broken after the hosting company switched to PHP 8.0. I have deactivated all the plugins and switched to WP default theme through FTP and PHPMyadmin, and then I got a few Fatal errors, which I managed to solve, but I got really stuck with this one since I am not a developer.
Browser message:
Warning: Undefined array key "wp_the_query" in */public_html/wp-settings.php on line 342
Fatal error: Uncaught Error: Call to a member function query() on null in */public_html/wp-includes/class-wp.php:601 Stack trace: #0 */public_html/wp-includes/class-wp.php(717): WP->query_posts() #1 */public_html/wp-includes/functions.php(960): WP->main('') #2 */public_html/wp-blog-header.php(16): wp() #3 */public_html/index.php(17): require('/www/webvol20/z...') #4 {main} thrown in */public_html/wp-includes/class-wp.php on line 601
Code from /wp-includes/class-wp.php, lines 598-602:
$GLOBALS['wp_query'] = $GLOBALS['wp_the_query'];
Code from /wp-includes/class-wp.php, lines 598-602:
public function query_posts() {
global $wp_query;
$this->build_query_string();
$wp_query->query( $this->query_vars );
Can anyone help with the code changes that I need to make? Please provide a "for dummies" style explanation :)
Already went through all web available solutions, but nothing worked. But to be honest, I wasn't able to completely understand some of them.

Error 500 after composer update in symfony 3

i try to clone my project into my computer.
I had clone the repository and done "composer update". All without any errors.
when i try to visit my site show this error
Call to a member function has() on null
500 Internal Server Error - FatalThrowableError
and the debug
CRITICAL - Call to a member function has() on null
CRITICAL - Uncaught PHP Exception Symfony\Component\Debug\Exception\FatalThrowableError: "Call to a member function has() on null" at C:\xampp\htdocs\richiesta_analisi\vendor\symfony\symfony\src\Symfony\Bundle\FrameworkBundle\Controller\Controller.php line 234
is the same repository that i had in remote so i don't understand why don't work.
i tryed to clear cache and composer upgrade but nothing.
Can you help me?

Akeneo - Cannot access specific parts of the backend (http 500)

I am having some trouble to test akeneo (PIM based on symfony) features, as some parts of akeneo backend return the following error:
Sorry, page was not loaded correctly
It specifically occurs if I click under enrich, or settings.
I checked under app/logs, here is what I found:
[2016-11-05 13:57:36] request.CRITICAL: Uncaught PHP Exception Twig_Error_Runtime: "An exception has been thrown during the rendering of a template ("There are no activated locales") in "/var/www/html/pim-community-standard/vendor/akeneo/pim-community-dev/src/Pim/Bundle/EnrichBundle/Resources/views/Attribute/index.html.twig" at line 68." at /var/www/html/pim-community-standard/app/cache/prod/classes.php line 5700 {"exception":"[object] (Twig_Error_Runtime(code: 0): An exception has been thrown during the rendering of a template (\"There are no activated locales\") in \"/var/www/html/pim-community-standard/vendor/akeneo/pim-community-dev/src/Pim/Bundle/EnrichBundle/Resources/views/Attribute/index.html.twig\" at line 68. at /var/www/html/pim-community-standard/app/cache/prod/classes.php:5700, LogicException(code: 0): There are no activated locales at /var/www/html/pim-community-standard/vendor/akeneo/pim-community-dev/src/Pim/Bundle/UserBundle/Context/UserContext.php:110)"} []
I searched almost everything I could find in forums, but I'm still stuck with this issue.
Another error is also logged (depending on where I click):
[2016-11-05 13:58:55] request.CRITICAL: Uncaught PHP Exception LogicException: "There are no activated locales" at /var/www/html/pim-community-standard/vendor/akeneo/pim-community-dev/src/Pim/Bundle/UserBundle/Context/UserContext.php line 110 {"exception":"[object] (LogicException(code: 0): There are no activated locales at /var/www/html/pim-community-standard/vendor/akeneo/pim-community-dev/src/Pim/Bundle/UserBundle/Context/UserContext.php:110)"} []
These are the two errors that I was able to find in logs.
I double checked the install & all requirements (ubuntu 1.14). Everything seems fine.
Would you have an idea?
Thanks in advance!
Try to go "My Account - Additional" and select 2 locales, English and Spanish for example. Then go to console and delete the folder
pim-community-standard/app/cache/
When starting again Akeneo, view all akeneo_pim logs, or make a
tail -f /logs*
in the logsfolder.

symfony 2.8 debug fatal error double message

Environment: Symfony 2.8.1 with XAMPP Version 5.5.24 on Windows 7.
If I trigger a fatal error in a controller, anything as simple as $array = ; in production environment, I'm getting a default php error:
Parse error: syntax error, unexpected ';' in C:\xampp\htdocs\tgsupport-test\src\AppBundle\Controller\DefaultController.php on line 16
followed by symfony custom error page message. Obviously I'd want to avoid to show eorr info in production.
Moreover in prod.log I see a double critical error: under php.CRITICAL and request.CRITICAL. Is really useful to show the same error twice?
I'm using default configuration, indeed I just installed default framework without any custom setting and I triggered my error in AppBundle/DefaultController, so I was wondering if I'm missing anything.
I missed a php.ini configuration to avoid to display error messages in page.

Symfony2: __toString() must not throw an exception

I am deploying my Symfony2 application, but I am getting the following error:
FatalErrorException in classes.php line 0:
Error: Method Symfony\Component\HttpFoundation\Request::__toString() must not throw an exception
Apache is slightly more descriptive, stating something about Monolog:
PHP Fatal error: Method Symfony\\Component\\HttpFoundation\\Request::__toString() must not throw an exception in /my/path/vendor/monolog/monolog/src/Monolog/Formatter/NormalizerFormatter.php on line 0
It is also the only thing It is not clear to me how this is happening. Dev-environment on my local machine is running fine.
I have tried to clear the prod cache, the composer cache and restarted apache service. I also did a fresh "composer install" after clearing its cache.
Anyone has an idea how this can be solved? Am running Symfony v2.7.4.
You should to check your $_COOKIE or $_SESSION for example;
The trouble is you could have array value in $_COOKIE, so on your debug environment you could fall into the following situation:
Debug::enable() //see, i don't exclude E_NOTICE here
$request = Request::createFromGlobals();
echo $request->__toString();
//so, from now you've got your Exception because of
//Debug package converts E_NOTICE to Fatal
//which turns into Exception
So if you want to fix this trouble you need to:
find the real reason of exception triggering (notice, deprecated, strict message, etc)
exclude it from Debug: Debug::enable(~E_NOTICE);
OR just remove (string)$request from your code if possible;
see Request code:
//part of __toString() method
foreach ($this->cookies as $k => $v) {
$cookies[] = $k.'='.$v;
}

Resources