{"action":"created","issue":{"url":"https://api.github.com/repos/laravel/framework/issues/19129","repository_url":"https://api.github.com/repos/laravel/framework","labels_url":"https://api.github.com/repos/laravel/framework/issues/19129/labels{/name}","comments_url":"https://api.github.com/repos/laravel/framework/issues/19129/comments","events_url":"https://api.github.com/repos/laravel/framework/issues/19129/events","html_url":"https://github.com/laravel/framework/issues/19129","id":227613443,"number":19129,"title":"[5.1 LTS] Strange session behavior","user":{"login":"emkays2000","id":28591707,"avatar_url":"https://avatars2.githubusercontent.com/u/28591707?v=3","gravatar_id":"","url":"https://api.github.com/users/emkays2000","html_url":"https://github.com/emkays2000","followers_url":"https://api.github.com/users/emkays2000/followers","following_url":"https://api.github.com/users/emkays2000/following{/other_user}","gists_url":"https://api.github.com/users/emkays2000/gists{/gist_id}","starred_url":"https://api.github.com/users/emkays2000/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/emkays2000/subscriptions","organizations_url":"https://api.github.com/users/emkays2000/orgs","repos_url":"https://api.github.com/users/emkays2000/repos","events_url":"https://api.github.com/users/emkays2000/events{/privacy}","received_events_url":"https://api.github.com/users/emkays2000/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"assignees":[],"milestone":null,"comments":2,"created_at":"2017-05-10T09:07:50Z","updated_at":"2017-05-10T11:04:22Z","closed_at":null,"body":"- Laravel Version: 5.1.46\r\n- PHP Version: 5.5.9\r\n- Database Driver & Version: NA\r\n\r\nI am setting few session variables in my search controller as below:\r\n```php\r\n        // Add the search form values to session too\r\n        session()->put('search-keyword', $keyword);\r\n        session()->put('search-geolocation', $geoLocation);\r\n```\r\nLater,\r\n```php\r\n        return view('search.index', compact('profiles'));\r\n```\r\nIn my search blade template, have this line:\r\n```.blade.php\r\n        <div style=\"background-image:url( '{{ $profile['_source']['picture'] }}' )\"></div>\r\n```\r\nI am using 'file' session driver and the above works very well until `$profile['_source']['picture']` is null. When it is null, for some reason session variable `search-geolocation` is never set! As checked in the session file at storage/framework/sessions: ....\"search-geolocation\";N;s:9....\r\n\r\nIf I change the `<div>` above to `<img>`, everything again works beautifully, regardless of whether `$profile['_source']['picture']` is null or not null:\r\n```.blade.php\r\n        <img src=\"{{ $profile['_source']['picture'] }}\" alt=\"\">\r\n```\r\nThis same problem never happens with the session variable `search-keyword`, whether `$profile['_source']['picture']` is null or not null; `search-keyword` appears as it should in the session file.\r\n\r\nRight after setting the session in the controller, I get correct value when I echo:\r\n```php\r\n        echo session()->get('search-geolocation');\r\n```\r\nAlso, this problem goes away when I debug the code (XDebug) and all the values are stored correctly in the session file as expected. So, debug is not of much help.\r\n\r\nI have already worked around this problem but I am not confident about session anymore. Therefore, want to understand what's going on here. Have tried changing the session driver without any difference.\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/laravel/framework/issues/comments/300449138","html_url":"https://github.com/laravel/framework/issues/19129#issuecomment-300449138","issue_url":"https://api.github.com/repos/laravel/framework/issues/19129","id":300449138,"user":{"login":"bbashy","id":1149200,"avatar_url":"https://avatars0.githubusercontent.com/u/1149200?v=3","gravatar_id":"","url":"https://api.github.com/users/bbashy","html_url":"https://github.com/bbashy","followers_url":"https://api.github.com/users/bbashy/followers","following_url":"https://api.github.com/users/bbashy/following{/other_user}","gists_url":"https://api.github.com/users/bbashy/gists{/gist_id}","starred_url":"https://api.github.com/users/bbashy/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/bbashy/subscriptions","organizations_url":"https://api.github.com/users/bbashy/orgs","repos_url":"https://api.github.com/users/bbashy/repos","events_url":"https://api.github.com/users/bbashy/events{/privacy}","received_events_url":"https://api.github.com/users/bbashy/received_events","type":"User","site_admin":false},"created_at":"2017-05-10T11:04:22Z","updated_at":"2017-05-10T11:04:22Z","body":"So `search-geolocation` in the session gets removed if a variable is `null`?\r\n\r\nHave you tried using a different name for the session? Have you tried switching them?"}}
{"actor":{"display_login":"bbashy"}}