Session start error with event listener
First, I apologize for writing in English. I am trying to implement custom insert tags. When I add an event listener, however, I get a runtime ’Failed to start the session because headers have already been sent’ error at line 1. I haven’t been able to find any information that would suggest what I am doing incorrectly. This error occurs even with an event listener that simply returns false. I will appreciate any insight you can provide.
PHP-Code:
namespace App\EventListener;
use Contao\CoreBundle\ServiceAnnotation\Hook;
use App\Classes\Collections;
use App\Model\CollectionModel;
use App\Model\CollectionitemModel;
use Contao\StringUtil;
/**
* @Hook("replaceInsertTags")
*/
class ReplaceInsertTagsListener
{
/**
*
* @return string|false
*/
public function __invoke(string $insertTag,
bool $useCache,
string $cachedValue,
array $flags,
array $tags,
array $cache,
int $_rit,
int $_cnt)
{
return false;
}
}