1

i have installed Symfony 2.7.41 and enabled production mode in app.php

$kernel = new AppKernel('prod', false);

when i tested in controller by making one eror

public function indexAction(Request $request)
    {
        echo "dsgds";
        $var=dd;
        exit();

    }

but even in production showing erorr instead of 500 internal server error

dsgds Notice: Use of undefined constant dd - assumed 'dd' in D:\xampp\htdocs\weebly\development-two\src\AppBundle\Controller\DefaultController.php on line 17

Already read following Dev Exceptions are shown in production environment

Moving app to production mode in Symfony 2

Symfony: disable exceptions in prod mode

Error on "production" environment on Symfony2

scott
  • 3,112
  • 19
  • 52
  • 90
  • add those that you already checked – Abdulla Nilam Feb 05 '18 at 05:06
  • @DeadManAlive.updated few still more referred now i dont have links – scott Feb 05 '18 at 05:07
  • @vision does the error page in general work? (https://symfony.com/doc/2.7/controller/error_pages.html#testing-error-pages-during-development) – fab Feb 05 '18 at 05:26
  • @fab.even i tried to create custom pages but my bad it only works for 404 not for fatal error or 500 internal server erorr.my aim is to hide fatal erorr and notice errors – scott Feb 05 '18 at 05:28

3 Answers3

0

dd is undefined variable here. if you want to set value of $var as string 'dd' then it will be ok but here you don't put any '' . so it is behaving a constant variable which you previously not d efined.

thank you

0

As was said before dd should be in ' (as string) to avoid error, but as i understand it's not what you are asking .

You want to hide exceptions ....

You may not like the anwser , but you sholdn't even try . Honestly (it's a bad idea) i don't know if it's even possible but you should start with symfony event system .

Maybe try to catch kernel.exception event and stop event propagation .

Some tips how to do it should be here :

https://symfony.com/doc/2.7/controller/error_pages.html https://symfony.com/doc/2.7/event_dispatcher.html

But it's a really a bad idea - you as a guy who creates code should try to do the code without error, and not hiding it (that why exists test and phpunit). IMHO best thing in symfony is that this framework forces you to learn OOP and error/exception handling

PS.second bad idea : maybe put all action code in try .. catch ?

Michał G
  • 2,234
  • 19
  • 27
0

It may be dump, but, as it occurs on production mode, have you clean your cache ? (or even delete it to be sure).

Kafei59
  • 11
  • 3