Error handeling in Silverstripe 4 - silverstripe

I´m using Silverstripe 4 and created a page with a form. Something gets wrong and I only get a blank page with:
"There seems to have been a technical problem. Please click the back button, refresh your browser, and try again."
In .htaccess I set php_flag display_errors on
In the _config.php I set error_reporting(E_ALL);
And in the mysite/_config/app.yml I set this:
Only:
environment: 'dev'
SilverStripe\Security\BasicAuth:
entire_site_protected: true
Now all I wanna do is to let Silverstripe show me the errors. In Silverstripe 3 the only thing to do was: Director::set_environment_type("live");
What must I do to show the errors?

In your .env file, you can specify an environment variable.
SS_ENVIRONMENT_TYPE='dev'

The term "There seems to have been a technical problem" is notice for CSRF failure: https://github.com/silverstripe/silverstripe-framework/blob/7603c6d79841df7712c0d1d5136ec402f3162e0c/lang/en.yml#L60
So setting silverstripe to dev mode or tweaking php error levels won't help here as it just outputs that when the csrf check fails.
You need to add the token or prevent the form handler from checking it:
https://docs.silverstripe.org/en/4/developer_guides/forms/form_security/#cross-site-request-forgery-csrf
If everything for the form is right then there is a possibility that the error could be caused by permission issues with PHP and the session write directory.

Related

Drupal - Disable SAML login in local instance

I am very new to Drupal. I have done the local setup and the front end is working fine. Now I need to login to the admin interface. Seems like there is a SAML configuration and when I try to access the /user/login page it is showing the following error :
The website encountered an unexpected error. Please try again later.
I can see there is one simplesaml folder in the codebase and I think this is handling the SAML login. Now in the local setup, I don't need to use SSO, but not sure how to disable this extension. I have checked in the core.extension.yml, but the fllowing extensions set to 0 there and hence I think this is not activated.
basic_auth: 0
externalauth: 0
simplesamlphp_auth: 0
Also in my local configuration settings.local.php, it is set as false:
$config['simplesamlphp_auth.settings']['activate'] = FALSE;
It will be very much helpful if somebody can guide me in the right direction. I have access to the database, but not sure where I need to make changes. This might be a simple thing, but I am blocked here.
The Error I am seeing the logs is like this :
Uncaught PHP Exception SimpleSAML\Error\Exception: "Could not find the metadata of an IdP with entity ID 'localhost:default:entityId'" at /vendor/simplesamlphp/simplesamlphp/modules/saml/lib/Auth/Source/SP.php line 317
You can login to Drupal using a console command.
Open a terminal, navigate to the project folder like
cd ~/project/my-project/web/
Then run
drush uli
the output will be a one time login link.

Updating failed. Error message: The response is not a valid JSON response

I get this error when i want to add a featured image to my wordpress post
"Updating failed. Error message: The response is not a valid JSON response."
In my case it was due to a web server configuration (Apache2):
AllowOverride None
Changed it to :
AllowOverride All
in
/etc/apache2/apache2.conf
I had the same "not a valid JSON response" error when trying to publish my content. WordPress seems to do a JSON post when publishing a new post/page so I checked the network tab in my Developer Tools. If you check the "response" tab for this JSON call you might see some more details about this invalid JSON response.
In my case (yours might be different) some deprecated debug message was outputted before the actual JSON data and messed up the response. After fixing the deprecated message publishing worked again.
If you are trying this on your local or production wordpress install you may likely get this error as your .htaccess file is not writeable for security reasons.
Error you will see in wordpress admin interface under permalink setting after you change from plain to any mode:
If your .htaccess file was writable, we could do this automatically, but it isn’t so these are the mod_rewrite rules you should have in your .htaccess file. Click in the field and press CTRL + a to select all.
Make sure your .htaccess file is writeable whenever you change your permalink setting from PLAIN mode to anyother mode like POST-NAME
For me this error was shown in the backend editor because of a line of text in another file which echoed that line of text on each response. Incl. when WordPress internally made its own request expecting a JSON response. Once i removed that line issue disappeared.
I got the same error:
Updating failed. Error message: The response is not a valid JSON
response
after deactivating WordPress plugin Gutenberg. I tried to reactivate it but the error still exists.
The solution to my error was installing the "Classic Editor" plugin.

Website layout is broken, <head> is empty and I can't access wp-admin (wp-login)

My site's https://www.beckers-trier.de layout and code is sort of broken. I don't code, but the theme is self-developed and I also don't remember changing anything about the site, except for adding the facebook pixel code in the . The Problem is that a few errors are given, which you can see in the wp-login site of my site. I can't login either, being warned that the cookie settings are closed because of a 'surprising output'
The error itself is quite self-explainatory, the server is trying to send some headers but some output has already started.
The warnings at start of the page are very likely to be generated from the PHP interpreter on your machine, either you have a weird display_errors directive in your php.ini or the constant WP_DEBUG on your wp-config.php is set to true.
Double check both configuration files and make sure the display of the errors are set to off and WP_DEBUG to false.

Drupal - White Screen of Death after updates (and login page returning 403 error)

I have just updated a site that is using Drupal and have now experienced the horrible WSOD.
I have searched through Google looking for any sort of solution/error log to help me find and fix the issue but nothing has worked. I have tried adding in the 'display errors' code in the index.php file and looked at the error_log file in the public directory and nothing.
I can not login to the admin page and check any modules as the login page for this is returning a 403 error.
Any suggestions?
Please go to Apache Error log. You will exact error messages there.
The log file's location is different for different OS and versions.
e.g httpd/log/error.log
Maybe your Drupal registry is broken.
Fix this using the registry_rebuild script (this is no module!)
There are times in Drupal 7 when the registry gets hopelessly hosed and you need to rebuild the registry (a list of PHP classes and the files they go with). Sometimes, though, you can't do this regular cache-clear activity because some class is required when the system is trying to bootstrap.
You might get something like:
PHP Fatal error: Class 'EntityAPIControllerExportable' not found in ...sites/all/modules/rules/includes/rules.core.inc on line 11
If this happens when you're trying to run update.php, and happens when you're trying to clear your cache, well, you have some trouble. That's what Registry Rebuild is for.
It also may happen that you've moved some module that Drupal requires to bootstrap, and you get a horrible error. Registry Rebuild will also rebuild the system table to get the modules in the right place so you can bootstrap.
You will need PHP-CLI or drush to run this.
https://drupal.org/project/registry_rebuild

Drupal "page not found" error keeps getting logged in Recent Log Entries

Our website keeps logging a "page not found" error under the Drupal Recent Log Entries, but we do not know where it is coming from. When clicking into the detail of the error, the location is marked as "http:///*", user is "Guest", and severity is "warning". Does anybody have ideas on where we can find out what's causing these errors to log?
Page not found warnings like this can be caused every kind of code that triggers an http request, like loading a .js or .css file or an image. A way to debug this is the quick-and-dirty method described by Lullabot which means that you add a debug_backtrace() at the point where the warning is registered (in your case probably the watchdog() function, see the comment by Randy Fay).
PS. #Arvind: If you're using the Drupal API correctly, there shouldn't be too many drupal_goto calls in your code.
do you have atypo error in your code? check if you have mistakenly commented coz i see /* in the link.
This has to be a local error. I would check for my drupal_goto calls in my code.
this is my guess and i'm no drupal expert. let us know if it helps.
atb!
You might have an issue with your favicon like I did, although I don't recalling it generating errors in my watchdog.
It's what triggered a lot of page not founds on my setup.
Basically, you normally put your favicon in your root. However, some browsers ( I believe IE6 ) , don't check the root for your favicon, but your theme folder.
I just duplicated my favicon in my theme folder, and my problem was solved.
Worth a try.

Resources