I have a simple authentication code like on a zf2 application
$this->auth = new AuthenticationService(new Session($this->namespace));
and the external modules used are
ZendDeveloperTools
BjyProfiler
Everytime, I try to authenticate, like
$this->auth->authenticate($adapter)
I get a "Session validation failed" error message.
When I disable ZendDeveloperTools module, I do not get this error but couldnot fix. I also checked Zend\Session\Container Session validation failed exception — Object(Closure) ZF2, but I do not have anywhere on my code
$sharedEvents->attach('', '', .. )
as suggested by Crisp
i had a same problem.
Look at:
ZendDeveloperTools/Listener/EventLoggingListenerAggregate.php Line: 64
$events->attach($this->identifiers, '*', array($this,'onCollectEvent'),
Profiler::PRIORITY_EVENT_COLLECTOR);
i uncomment it, then i don't get the error.
Hope it was helpful.
Related
I am using subfission/cas for my application. I have followed all installation steps. I am using windows, if that matters. More precisely, I have configured the following:
I ran the following in my terminal
composer require "subfission/cas" "dev-master"
I configured my Kernel.php accordingly, adding the following:
'cas.auth' => 'Subfission\Cas\Middleware\CASAuth',
'cas.guest' => 'Subfission\Cas\Middleware\RedirectCASAuthenticated',
I ran the following command:
php artisan vendor:publish
I also set up my cas server in my cas.php config file:
'cas_hostname' => env('CAS_HOSTNAME', 'cas.myserver.me'),
'cas_real_hosts' => env('CAS_REAL_HOSTS', 'cas.myserver.me'),
What I want is a middleware for all my routes, so I added the following route rule in my routes:
Route::middleware(['cas.auth'])->group(function ()
{
Route::get('/', function ()
{
return view('welcome');
});
});
Basically, I want to redirect everyone who is not logged in to the login page whenever I access the main page (for now, I will add more routes in the future). What happens is that the users are redirected to the login page when they are not logged in, but after the login I receive the following error:
ErrorException (E_WARNING)
DOMDocument::loadXML(): Opening and ending tag mismatch: hr line 1 and body in Entity, line: 1
No matter what view I'm redirecting the user to. I tried the default welcome page as well as an empty view, but I still get the same error.
EDIT: I have used the dev-master branch from subfission/cas for the above error and after switching to 2.1.1, I get a different error:
session_name(): Cannot change session name when headers already sent
EDIT 2: I did some more digging and I enabled internal errors in my cas client class with:
libxml_use_internal_errors(true);
And now I get the following:
Authentication failure: SA not validated Reason: bad response from the CAS server
And the cas response is:
The thing is that I use the same cas server for another 2 projects and it works well for those (but those aren't laravel projects.
I know it's been a while, but for anyone else having issues like this, the issue is the protocol selected for which your web service communicates with your CAS(Central Authentication Service) provider. There are two main protocols used for SSO/CAS in this package:
SAML(Security Assertion Markup Language) version 1.1 & 2
CAS Protocol v3.0
[Confusingly enough, CAS protocol shares the same namespace as the service.]
The idea is to match the protocol and version with your identity provider. It sounds like your provider is using CASv3.0, which is why disabling SAML worked.
Also, if you enable debug mode, you will see further error details in your log file to help your troubleshoot.
Best of luck!
I managed to solve the issue by disabling the SAML in the cas configure file:
'cas_enable_saml' => env('CAS_ENABLE_SAML', true),
change to
'cas_enable_saml' => env('CAS_ENABLE_SAML', false),
I'm using heroku's rack-timeout gem, along with dynamic error pages as described here.
However, when timeout raises an exception, it get's routed as a 500 error rather than 503.
I could catch the exception with a rescue_from in my application controller and manually route to errors#503, but that would prevent plugins like Rollbar from recording the exception.
Is there a way to get the correct error page rendered and ensure plugins like Rollbar still get wind of the exception?
I ended up using the rambulance gem, which provides a simple configuration option to solve this:
# config/initializers/rambulance.rb
Rambulance.setup do |config|
config.rescue_responses = {
"Rack::Timeout::RequestTimeoutException" => :service_unavailable
}
end
The author has also written up some good reasons why not to use the approach I was previously using:
Remove custom errors page section from the guides
I know this is an old question, but there's no need to add a gem dependency for this.
rack-timeout raises an exception; the 500 results from that exception being unhandled. To handle that exception and get a 503 or whatever else you might want, add:
config.action_dispatch.rescue_responses["Rack::Timeout::RequestTimeoutException"] = :service_unavailable
to your application.rb file.
I am trying to treat the invalid requests on my Laravel app, something like redirecting to the root will work just fine, but I can't manage to do it.
In the documentation and around stackoverflow I saw this is always the solution:
App::missing(function() {
# handle the error
});
I thought that would just go to the routes file but no. Then I saw in some post it should be in the app/start/global.php file but it still didn't work.
In the docs it says I can "register an error handle". Is that what I should do? What does this mean? What should I do?
Ultimately this can be put anywhere, but app/start/global.php is probably the best place for it.
App::missing(function($exception)
{
return Response::view('errors.missing', array(), 404);
});
Try putting this in there. In fact, if you've just setup a fresh installation, you should already have one there.
Here is how you can register an error handler, like so;
App::error(function(Exception $exception, $code)
{
//Now you can check for different exceptions and handle each on their own way.
}
This will be for PHP general Exception class which will make all exceptions go here, but you can change Exception to the specific Exception class of you own and handle it accordingly.
App::missing will generally be called when a page within your site has not been found, allowing you to show a default page for when users have found a non existing page. So if you are wanting to handle missing pages, use App::missing else use App::error.
I updated to the latest version of Laravel 4 using composer update. Now I'm having a problem with the error handling library it uses - Whoops. When I have an error in my code, for instance an syntax error the following happens:
I reload the page
The actual exception ('Unexpected xxxx at ...') appears for less than a second
Another exception replaces it:
Cannot modify header information - headers already sent by (output started at /Users/planewalker/Sites/jean/welper/vendor/filp/whoops/src/Whoops/Run.php:204)
The code at the above line is this:
// If we're allowed to, send output generated by handlers directly
// to the output, otherwise, return it so that it may be used by
// the caller.
if($this->writeToOutput()) {
echo $output;
}
return $output;
and more specifically the echo $output; part.
Does anyone know why this happens?
UPDATE:
I've now determined that the problem is caused by the set_cookie function in combination with the Whoops library's exception output. It seems that the set_cookie function is called after the Whoops library has started outputting its view.
The only solution I found was to use a different session driver that the 'cookie' one. I've switched to using 'native' and the problem does not appear anymore.
Have you edited the start.php or path.php for echoing debug informations. In the most cases this is the problem.
Because start.php is called before the errorhandler is called and in Laravel for every output headers are sent.
Try updating your Laravel 4:
composer update
This problem should be fixed and you would receive the first exception which is thrown.
I'm setting up our Magento 1.7 store, hoping to be ready for launch soon. I've noticed a problem:
When users try to create a new account, they fill out their info on /customer/account/create page just fine, then when they click submit, they get this 500 Error:
The website encountered an error while retrieving
http://example.com/customer/account/createpost/.
the account is actually created, however.
Similar deal on when users submit their email on the Forgot Password page, they press submit and get this:
The website encountered an error while retrieving
http://example.com/customer/account/forgotpasswordpost/.
no email is sent.
If you see this and know how to help with this prob, your advice would be much appreciated, truly.
In case it helps, we are using a theme, rather than default.
EDIT - (I was asked if I had checked server error)
My server errors show as this, for the above situations:
Forgot Password submit shows this error:
Fatal error: Call to undefined method Mandrill_API::addTo() in
D:\Magento\app\code\core\Mage\Core\Model\Email\Template.php on line
438
and
Create Account submit shows this error:
Fatal error: Call to undefined method Mandrill_API::addTo() in
D:\Magento\app\code\core\Mage\Core\Model\Email\Template.php on line
438
as well.
Here is 6 lines(437-442) of that Template.php file:
foreach ($emails as $key => $email) {
$mail->addTo($email, '=?utf-8?B?' . base64_encode($names[$key]) . '?=');
}
$this->setUseAbsoluteLinks(true);
$text = $this->getProcessedTemplate($variables, true);
[UPDATE]
I've learned that when I enter a random, fake email for Forgot Password, and press submit, a confirmation appears, saying something like "If this email exists, then a new email was sent to that email!", but when I submit an email of a real existing customer, then it gives me the 500 error I've mentioned.
Still nothing - if anyone out there sees this, and you have a bit of time to help solve this perhaps, may Talos bless you!
[SOLVED]
I turns out this was a problem with transaction emails.
Cause by an extension, Mandrill, which is added to magento when I installed the MailChimp extension, called "MageMonkey - MailChimp Integration by ebizmarts"
Once I enabled Mandrill, in config, advanced, all transactions and transaction emails work perfectly fine!
It's possible that it's a .htaccess or server configuration problem. Where is it hosted? Do you have a .htaccess file in the root of the installation?