PHP7 + Symfony 2.8, Failed to write session data

前端 未结 4 1228
挽巷
挽巷 2020-12-09 17:12

i compiled php7 on my own (974f6c2a705). if i run php7 + php-fpm + nginx using symfony i get this error:

(using the snc redis bundle for sessions:)

          


        
4条回答
  •  轻奢々
    轻奢々 (楼主)
    2020-12-09 17:59

    PHP7 is more strict with session handling for custom session handlers. Symfony's custom session handler for its write method is, for whatever reason, returning false. Previously this did not trigger an error but now it does.

    Since we do not have a lot of information on which custom session handler you are using, I would suggest setting a different custom session handler if possible since most of them appear to return true.

    Here are the different session handlers Symfony, most of them appear to explicitly return true except for the Memcache ones and WriteCheckSessionHandler:

    https://github.com/symfony/symfony/tree/582f4753a343f230fbe18b4e9a0747d48351ddfb/src/Symfony/Component/HttpFoundation/Session/Storage/Handler

    EDIT:

    Since you mention the Snc Redis Bundle session handler, are you sure you are using the most up-to-date version? A year ago it was modified to always return true on write:

    https://github.com/snc/SncRedisBundle/blob/master/Session/Storage/Handler/RedisSessionHandler.php

    UPDATE

    Submitted a bug to PHP to see if we can figure out a more useful error message for future versions (please vote or leave a comment on the bug report):

    https://bugs.php.net/bug.php?id=71070

提交回复
热议问题