After loading my Twig-Template by Controller and showing it - it takes a while and i get this error displayed: "An error occurred while loading the web debug toolbar (404: Not Found)."
Now i researched about 2 hours and can't find the right solution for me! I found the "thing" causing this issue - its the following route:
showPage:
pattern: /{a}/{b}/{c}
defaults: { _controller: MyBundle:Page:show, a: null, b: null, c: / }
requirements:
b: \d+
c: .+
I changed the order in routing_dev.yml so that routing.yml will be imported before WDT so it can override it - routing_dev.yml looks now like:
_main:
resource: routing.yml
_wdt:
resource: "#WebProfilerBundle/Resources/config/routing/wdt.xml"
prefix: /_wdt
_profiler:
resource: "#WebProfilerBundle/Resources/config/routing/profiler.xml"
prefix: /_profiler
_configurator:
resource: "#SensioDistributionBundle/Resources/config/routing/webconfigurator.xml"
prefix: /_configurator
I use the current Symfony-Version 2.5.0 - the .htaccess file is the default one from Symfony2-Repo - mod_rewrite and mod_alias are enabled!
If i go to a non-existing page and symfony says no route for "bla" found - the toolbar works.
Do you have an Idea how to make an exception for WDT-Routes?
I was wrong with my thought it were a route Problem - the Problem caused in an EventListener which used Doctrine DBAL QueryBuilder and tried to pass the Object to "fetchAll" of DBAL-Connection.
This cause in an Error but Symfony doesn't tell anywhere it only shows my Site and says 404 for Debug-Toolbar.
Open log file app/logs/dev.log and search for CRITICAL keyword, You will found the Fatal Error that not catched by Symfony. Try to fix it.
Late to the party here, but I had the same situation and it was really hard to find the answer. It's exactly what nPoday said here on Jun 9 2014: I had a listener that was throwing an error, though it wasn't Doctrine related. It was an issue with an AWS wrapper, which wasn't even being fired by the application on startup nor the page I was loading that exhibited the issue. Definitely check your listeners, disable them one by one, and you might find the debug toolbar suddenly starts working.
There are many things that may break the toolbar, one of the most common ones is an unfronted error. So make sure you check all your logs before you pull all your hair out.
In my case there was "NOTICE: PHP message: PHP Fatal error: Access level to UserBundle\Entity\User::$id must be protected (as in class FOS\UserBundle\Model\User) or weaker in ..." since my id was private.
After fixing that toolbar has reappeard.
Related
I'm trying to update symfony from 3.4 to 6.0.1
And i got an error
Class "" used for service "security.listener.user_checker.integration" cannot be found.
I have this error for each blocks in firewalls section
integration:
pattern: ^/integration
host: %base_host%
stateless: true
custom_authenticators:
- integration.authenticator.token
provider: integration_provider
I checked https://github.com/symfony/symfony/blob/6.0/src/Symfony/Component/EventDispatcher/DependencyInjection/RegisterListenersPass.php#L119
and
https://github.com/symfony/symfony/blob/6.0/src/Symfony/Bundle/SecurityBundle/DependencyInjection/SecurityExtension.php#L472
So ChildDefinition has no class(but has parent)
And I can't understand how it should work. Which class should be returned in RegisterListenersPass and where it should be set
I found a temporary solution.
It does not resolve the base problem, and I still want to figure out with my problem.
But now I can describe service like
security.listener.user_checker.integration:
class: Symfony\Component\Security\Http\EventListener\UserCheckerListener
And the error gone.
coming from Java development, I learned to appreciate LogLevel, how to set it in Logback or Log4j.
Monolog is used in my symphony 4.2 project.
I would like to see that from a certain controller/namespace the log entries with level info can also be seen in the production log file without all the other log entries with the info level filling the log file.
Unfortunately I didn't find any explanations.
After a little more research, I configured my monolog.yaml for dev and also prod this way
monolog:
channels: ['appinfo']
handlers:
custom:
channels: ['appinfo']
level: info
max_files: 30
path: "%kernel.logs_dir%/appinfo.log"
type: rotating_file
The important thing is the channel, appinfo in my case.
The handler, custom in my case, can be named any way you like.
Then in the services.yaml one has to define the "type" of the injected logger.
App\Controller\DefaultController:
arguments:
$logger: '#monolog.logger.appinfo'
This works with controllers as with services
My project is in Symfony 3.2.6 and I try to generate the i18n routes in production mode with BeSimpleI18nRoutingBundle.
In dev mode, it's ok.
But in production mode, routes generated are always in same locale (the current).
(I already clear the cache)
I use these links to switch :
fr
en
Do you have any idea ?
Thank you in advance.
I found the solution.
For work in the dev mode, I had to update the "_main" route in "routing_dev.yml" with "type: be_simple_i18n" like this :
_main:
resource: routing.yml
type: be_simple_i18n
And the solution for the production mode is to add the same line in the "config.yml" where the "routing.yml" is imported like this :
framework:
...
router:
resource: "%kernel.root_dir%/config/routing.yml"
type: be_simple_i18n
After some time I always get an internal server error 500 when reloading the page a second time.
Clearing the cache fixes to problem for about 10 hours
Switching the browser lets me again load the page, gives me the error on second reload
Caching is not enabled for the search action.
Only one module is affected, other modules work during the time the site is down.
Any ideas where to look? The symfony error logs are not really helpful the request does not even reach symfony.
This could be related to route caching. Try disabling your route cache in factories.yml and see if this helps.
For Example:
routing:
class: sfPatternRouting
param:
load_configuration: true
suffix: ''
default_module: default
default_action: index
debug: %SF_DEBUG%
logging: %SF_LOGGING_ENABLED%
generate_shortest_url: true
extra_parameters_as_query_string: true
cache: ~
I'm facing an issue while trying to use Curl in Buzz for Symfony2 (I've finally managed to install it, see this post).
I use it it one on my bundles, and I've updated services.yml, adding these :
# cURL client for Buzz
buzz.client.curl:
class: Buzz\Client\Curl
public: false
calls:
- [setVerifyPeer, [false]]
# Buzz browser
buzz.browser:
class: Buzz\Browser
arguments: ['#buzz.client.curl']
And when I go and check my project's page, here's the error I get :
InvalidArgumentException: There is no extension able to load the configuration for "buzz.client.curl" (in myBundle) Looked for namespace "buzz.client.curl", found none
So from what I understand, I have to change one of Buzz's namespace declarations somewhere.
But does anybody know what, and where?
Well, my mistake, I simply didn't use the right format for my yml file.
Here is the code of the services, in case anyone has the issue. Think of the 4 spaces, that saves a lot of time...
services:
cURL client for Buzz
buzz.client.curl:
class: Buzz\Client\Curl
public: false
calls:
- [setVerifyPeer, [false]]
Buzz browser
buzz.browser:
class: Buzz\Browser
arguments: ['#buzz.client.curl']