italia / spid-cie-php

Software Development Kit for easy SPID/CIE access integration with simplesamlphp - developed and mantained by Michele D'Amico @damikael
https://italia.github.io/spid-cie-php/
Apache License 2.0
83 stars 39 forks source link

Errori di sessione durante la chiamata al metadata #73

Closed deligant closed 3 years ago

deligant commented 3 years ago

Chiamando il metadata del SP (myservice/module.php/saml/sp/metadata.php/service) vengono generati diversi errori da parte del gestore di logger e session che vengono perciò scritti nel file e/o serviti inline e/o scritti comunque nel log di sistema

PHP Warning: session_id(): Cannot change session id when headers already sent in [...]spid-php/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/SessionHandlerPHP.php on line 191 PHP Warning: session_cache_limiter(): Cannot change cache limiter when headers already sent in [...]/spid-php/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/SessionHandlerPHP.php on line 115 PHP Warning: session_cache_limiter(): Cannot change cache limiter when headers already sent in [...]/spid-php/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/SessionHandlerPHP.php on line 117 PHP Warning: session_start(): Cannot start session when headers already sent in [...]/spid-php/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/SessionHandlerPHP.php on line 118 PHP Warning: ini_set(): Headers already sent. You cannot change the session module's ini settings at this time in [...]/spid-php/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/SessionHandlerPHP.php on line 243

deligant commented 3 years ago

Ho risolto aggiungendo alla riga 186 del file spid-php/vendor/simplesamlphp/simplesamlphp/lib/SimpleSAML/SessionHandlerPHP un semplice or header_sent()

La riga diventa quindi: if (!self::hasSessionCookie() or headers_sent()) { image

damikael commented 3 years ago

Eventuali modifiche al core di SimpleSAMLphp non devono essere apportate direttamente sul codice in /vendor, e nemmeno sul presente repository. Modifiche relative a SPID, invece, possono essere applicate come patch in /setup/simplesamphp. Essendo questa, una modifica di impatto generale su SimpleSAMLphp, suggerisco di proporla sul repository ufficiale: https://github.com/simplesamlphp/simplesamlphp