Redirect for anonymus user doesn´t work from Controller

30/07/2018


Community,
i´ve got a simple COntroller for redirect my users by visiting a special path (localhost/drupal8/check). At the moment the redirect works for the administrator and for registrated user, if they are logged in, but not for the quests of my site (i know that it is only a local site).

namespace DrupaltestmoduleController; 
use DrupalCoreControllerControllerBase;

class EntityChecker extends ControllerBase {

  public function redirectToFront($bundle, $label) { return $this->redirect('<front>');

}
}

In the log i´m getting the following error:

[30-Jul-2018 09:30:25 UTC] RuntimeException: Failed to start the
session because headers have already been sent by
“C:wamp64wwwdrupal8vendorsymfonyhttp-foundationResponse.php” at
line 1274. in
C:wamp64wwwdrupal8vendorsymfonyhttp-foundationSessionStorageNativeSessionStorage.php
on line 141 #0
C:wamp64wwwdrupal8corelibDrupalCoreSessionSessionManager.php(164):
SymfonyComponentHttpFoundationSessionStorageNativeSessionStorage->start()

Thanks a lot for helping me

قالب وردپرس