When using the Symfony2 plugin for PHPStorm, I sometimes see a Weak Route warning:
What does it mean?
Worked it out. The Symfony2 plugin parses the appDevDebugProjectContainer.php file to get route and service information. However this file is only recompiled when the web page is loaded which means newly created routes are not included.
To get around this the plugin also parses the config files but this is not 100% reliable so routes discovered in this way are marked as "weak". Reloading the web page will make the warning go away.
I finally fixed this issue for my situation (Symfony 2.8 / PhpStorm 2016.3).
It's similar to #Atmarama 's solution but I think my version of PhpStorm (2016.3) is different and/or Symfony 2.8.
My solution also doesn't involve the deprecated setting. I hope this will help others:
In PhpStorm go to Languages & Frameworks > PHP > Symfony > Routing and add the path to appDevProjectContainerUrlGenerator.php.
In my case this is:
var/cache/dev/appDevDebugProjectContainerUrlGenerator.php
Check path to file urlGenerator
For me right path is:
var/cache/dev/appDevDebugProjectContainerUrlGenerator.php
And after make click to button "Clear Index" above
I also get the same problem and in my case, because i use '/' to declare the render template instead of ":"
Changing from "/" to ":" cleared that warning in my case
Related
I am setting up a web api for the first time and I have another project for reference. It is a .NET framework project that will have a React frontend. I am running it using Visual Studio and IIS Express.
I have no build errors when I start the api project. It has swagger added so I can test database calls, so I know the api itself is working. But I am missing adding something as I am looking to add more security to it.
I am trying to verify authentication and I want to use integrated Windows authentication. When I set a break point, the user in the HttpContext.Current is never set and is never authenticated, so I can't add any authorization filters.
I went back to just the basic empty api project that has the frontend web pages removed to see if I removed something and it shows the same issue. So I either removed it again or I am actually missing adding something.
I am not sure where to look for what is missing, so any pointers would be appreciated.
The left browser is what I am expecting and the right browser is what I am seeing.
I don't need the directory browse turned on, so seeing a 403.14 - Forbidden is fine. But I am clearly missing something to get to that point. Is there a better way to figure out which resource/dependency is causing this error?
I can also see the working version requested url is what I am expecting, but the other is just a /.
Is there a way to resolve that if this is the error?
I can add code snippets if needed, but I haven't yet as I am not sure where the issue is.
I ended up finding the answer using blank test web apis to see what I may have left in that wasn't needed. The project was set up using this option:
After removing the views, etc., to make it strictly an api project. I started removing references (and clearing the associated errors) and seeing what happened with the build after each change.
Under the App_Start folder, there were some additional files that weren't present in the project I had for comparison - FilterConfig, and RouteConfig - which were also called in the Global.asax.
I removed the call in Global.asax for all three and I was able to see the expected http error page.
I dont have enough reputation for a comment, but you got 404 error, which, as you know, means there is nothing on that url. So check the route config and startup.cs Edit: I am on the phone so I didnt saw you already solved it. Good :)
I would like to implement the SimpleSamlPHP bundle in my symfony project But, I'm having some issues with the redirect after the login.
Let me explain a little:
I have loaded "simplesamlphp/simplesamlphp" in my composer. So, the bundle sits in the vendor directory.
Then I wrote my own bundle where I configured the simplesaml, made controllers with login actions,...
Everything works (in the sense that I effectively have a button that redirects to the Idp (I configured) and does its thing). But then I get redirected to: http://BASEURL/module.php/saml/sp/saml2-acs.php/IDENTIFIER, which it does not find, because the files are in the vendor bundle.
When reading the documentation carefully, I saw that the baseUrl should point to the simplesaml package. But, because that package is in the vendor, I can't do that.
Is there a way to still use the simpleSAMLphp bundle or do I need to look for a symfony bundle to use simpleSAML?
Thank you.
I highly recommend you to give a try to :
https://www.lightsaml.com
I've tried to do a simple IDP / SP service and it works pretty well and straightforward. Along that I find the website examples also well written so you can start with a base.
If still want to use simplesaml search for "simplesamlphp-bundle" in packagist.org there is at least 3 packages that bundlify this and can help you out to set it up.
Im trying to add some custom javascript to my admin but not having such a good time. What I tried so far is.
Requirements::javascript('../mysite/modules/widgets/widgets/calculator/admin/js/admin.js');
The path is correct because when I do fopen to that it returns true.
I have also tried the following.
LeftAndMain::require_javascript('../mysite/modules/widgets/widgets/calculator/admin/js/admin.js');
Same thing with fopen.
It doesn't give any error niether is it loaded(I checked network tab in dev tools)
The path should be relative to the site root not the cms or framework folders. In other words: 'mysite/modules/widgets/widgets/calculator/admin/js/admin.js'
Depending on your situation, I've had more luck using yml for this. I'm not convinced the dynamic loading always works perfectly on ajax requests. In this case it would look like:
LeftAndMain:
extra_requirements_javascript:
- mysite/modules/widgets/widgets/calculator/admin/js/admin.js
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.
I got some problems with Drupal's IMCE module. When I try to upload inline images from admin, it doesn't upload any images. I get this JS error on firebug:
"NetworkError: 404 Not Found - http://www.mydomain.com/imce?jsop=upload&dir=."
If I go to that URL it gives me 404 not found page. If I go on my other Drupal that uses same system, it gives me JSON data result with same URL. Settings are same. And it has worked before on both systems. Now just it stopped on another one.
Also all the files folder should have correct rights. Is it some JS thing or? Anyone have had anything similar?
Thanks!
Yeah, I was having this issue too. For me it was a conflict with the Fast 404 module I had installed also. If you've got that module installed try disabling it to see if it fixes the problem. If it does then you'll want to look into using an advanced config for fast 404. Details of that are outlined in the readme.txt file in the fast_404 module dir.
I have had this problem too.
instead of disabling the module, I whitelisted the string jsop in sites/default/settings.php
$conf['fast_404_string_whitelisting'][] = 'jsop';
That fixed the problem.
Important: If you are editing sites/default/settings.php, first give write permission to that file first. edit it, and dont forget to set permission to 444 after editing.
Here is why
I fix my problem with this missing line in settings.php:
$conf['404_fast_paths_exclude'] = '/\/(?:styles|advagg_(cs|j)s)|(?:system\/files)\//';