Symfony 4.1 dump doesn't work - symfony

I just installed the Symfony 4.1, the dump function doesn't work on controller but it works on twig files, if I remove the symfony/debug-bundle, then the dump works correctly in controller but it doesn't work in twig properly, it acts like simple var_dump.
Does any body have any idea why this is happening?

Symfony have new features for dump.
Now dump shown in symfony profiler.
Please check proper. In symfony profiler

This problem is fixed with symfony 4.1.1, https://github.com/symfony/symfony/releases/tag/v4.1.1
dd() in controller work after upgrate to 4.1.1 with composer "php composer update".

Just be careful, if you use dump in controller, then you should have WebProfilerBundle installed as well. Then you see output inside of that toolbar and not in page content.

I had the same problem just now and the other answers here were not relevant. If you look to the Profiler Bar, the "crosshairs(debug)" icon will show your dump from twig only (sometimes).
To see ALL dumps, you sometimes need to go track them down in the "Ajax Requests" part. To do this, click the Ajax Requests in the Symfony Profiler bar at the bottom of the screen. Then click the lines until you see a AJAX request that fired and has your dump.
The reason why only your Twig dump showed up is that the profiler bar is mostly about the primary request. The suppression is an ajax secondary request. The dump you asked about was in the ajax not the primary request.

Related

Handling 404/4xx/5xx errors in Symfony 4

I'm using Symfony 4.4.10 and I do have problem with correct error 4xx/5xx handling to get users to my custom html.
On production, when 500 error occurs, I'm getting this kind of screen:
Which is weird, because I followed this tutorial: https://symfony.com/doc/current/controller/error_pages.html
I have my templates overridden (like here), but still above screen occurs. (adding error500.html.twig file isn't changing anything)
When I'm debuging on dev it's ok, I mean, with this custom "_error" route.
What can be the problem here?
404 errors and sometimes work, sometimes not.
Regarding the documentation and your shared code, you are right.
Have you got clear cache dev and production environment ?
php bin/console cache:clear

Symfony2: $_POST variables are empty on deployment

I'm currently working on symfony2 projects. Each time, the deployment process is a real pain in the back (even with the cookbook advices).
I have this strange feature that I can't explain. My post variables are always empty in some bundles of symfony 2, no matter how I access them ($_POST['foo'] or request->get('foo')). This feature is online only. On my local server, it works perfectly well.
Example 1: coresphere console bundle
I'm using the coresphere console bundle to run command line on my ovh remote server. But the bundle commands were never working (no matter what my installation was) ie my post variables were always empty causing each command to crash. I thought that may be an error in some of my other installed bundles was causing the post variables of the console bundle to be empty. So I installed it on an empty symfony2 project (I even removed Acme and of course I tested that everything was working on my local server before uploading the project). The console still didn't work. My only solution (a bad one though) was to hack the javascript console.js of the bundle and transform the post request into get request. It then worked fine. At this stage I thought: "ok may be the problem comes from ajax post request on ovh?"
Example2: A home made bundle for a project
I build a bundle for a project. In this project I don't use ajax post request at all. And still, my post variables are always empty (I remind that locally, everything works just smoothly). For this bundle I'm using FOSUserBundle with HWIOAuthBundle for authentication (if it has anything to do with that?)
Summary
I'm clueless about what is going on and I would like to have some sort of track to follow. Just as a reminder: I'm using an OVH shared server with the performance package. I can use git up there. But I can't really use console command (even in ssh). So that's why I'm using the coresphere console bundle.
Thank you for your help.
I got a solution for my home made bundle:
The problem was coming from my routing.yml file (in app/config). I was using fosjsrouting and it seems that the routing of fosjsrouting needs to be called at the very end of the routing.yml file (in app/config).
See below:
app/config/routing.yml:
... and at the very end:
fos_js_routing:
resource: "#FOSJsRoutingBundle/Resources/config/routing/routing.xml"
However, I still don't understand the problem with the coresphere bundle. This doesn't solve it.

How does symfony2 inject the profiler?

When I use the dev AppKernel of my app symfony shows a profiler bar at the bottom of the site.
How does symphony does this? Does it transparently inject something into my templates? I ask this because when I output raw text with "return new Response" from a controller action no profiler code is appended.
Web profiler is injected during event kernel.response.
Precisely it's caused by WebDebugToolbarListener.php.
It checks if response content type is html and there's no xdebug token header.

Error in Exposed Filter with AJAX in Drupal View

I'm receiving an error when i try to filter a Drupal view using a regular exposed filter with AJAX(autosubmit).
An error occured while attempting to process /views/ajax:
Object [object Window] has no method 'indexOf'
This is what i've done:
Clear all the cache, run cron and update.php
Views, ctools and drupal core were out-of-date, so i update them and run update.php
Check that the view had Ajax enabled.
Test if using Better Exposed Filters worked, din't work.
Install JQuery Update module and enable it, din't work either.
Create another exposed filters(by date, type, title) same error.
Something important to mention is that the filters works in the View Preview.
The view is very simple, the only thing it does is show a list of events (event content type) and i want to filter the content by the restaurant (wich is a select list of the content type) and that error is been shown.
This is the spects:
Drupal Core: 7.19
Views Module: 7.x-3.5
PHP Version: 5.3.18
Apache2.2.22
MySQL 5.1.66
Using Acquia Dev Desktop stack on Windows.
Thanks in advance
This is the result code when i export the view:
File Code, Click Here
Try to enable clean URLS. This worked with me.

Unknown record property / related component "permissions" on "sfGuardUser"

There are a couple of other questions on here regarding this but they are old and have not been answered satisfactorily IMHO.
I am getting this error - "Unknown record property / related component
"permissions" on "sfGuardUser", referer:" - in my error_log when I
attempt to login to my symfony 1.4 app after deployment. I do not get
it on my local machine.
When I submit the login form, Symfony throws a 500 error. If I refresh
the page, the login form is reposted and I am logged in.
Can anyone suggest what might be causing this?
The answer can be found here: http://oldforum.symfony-project.org/index.php/m/102097/
The solution is:
rm ./lib/model/doctrine/base/BaseSfGuard*
./symfony cc
from http://oldforum.symfony-project.org/index.php/m/102097/
It seems that at some point I had this relation defined in my own schema file and this had been cached somewhere. When I moved the code to a new server without the cache, Symfony generated classes in a location which overrode the plugin's versions.
When I submit the login form, Symfony
throws a 500 error. If I refresh the
page, the login form is reposted and I
am logged in.
What browser do you use? I have same problem,but only in Opera...
I don't like using build all commands. If an SQL statement fails, building all can delete data. Never user build all commands on a production environment for Symfony.

Resources