![]() |
Lost session - Printable Version +- CodeIgniter Forums (https://forum.codeigniter.com) +-- Forum: CodeIgniter 4 (https://forum.codeigniter.com/forumdisplay.php?fid=28) +--- Forum: CodeIgniter 4 Support (https://forum.codeigniter.com/forumdisplay.php?fid=30) +--- Thread: Lost session (/showthread.php?tid=70509) |
Lost session - scalla - 04-19-2018 Don't know if am the only one who witnessed this, the session is lost when a redirection occurs. RE: Lost session - natanfelles - 04-19-2018 Have the session active int the page where you are redirected? Does any Exception appear? RE: Lost session - skunkbad - 04-19-2018 You're not likely to fix the problem without showing us your session config, and how you are using session. RE: Lost session - scalla - 04-19-2018 well the session is initiated in a core controller function __construct(...$params) { parent::__construct(...$params); Asset::_init(); // Ensure session is running session()->start(); } and the session settings public $sessionDriver = 'CodeIgniter\Session\Handlers\FileHandler'; public $sessionCookieName = 'icvent_session'; public $sessionExpiration = 7200; public $sessionSavePath = '../../Tarena/writable/temp'; public $sessionMatchIP = false; //public $sessionTimeToUpdate = 0; public $sessionTimeToUpdate = 300; public $sessionRegenerateDestroy = false; RE: Lost session - scalla - 04-19-2018 note, when i downgrade to php 5.6, it works well RE: Lost session - InsiteFX - 04-20-2018 This is how I start the sessions in a BaseController PHP Code: <?php namespace App\Controllers; RE: Lost session - scalla - 04-21-2018 Tried this, still same thing, once the page redirects, the session is get destroyed RE: Lost session - InsiteFX - 04-21-2018 Your sessSavePath doe's not look right to me, I do it like below. PHP Code: // change this to below See if that makes a difference. RE: Lost session - scalla - 04-21-2018 (04-21-2018, 03:59 AM)InsiteFX Wrote: Your sessSavePath doe's not look right to me, I do it like below. maybe am not asking the right question, after the session is set, below is what its expected to be when it redirects. PHP Code: array(2) { ["__ci_last_regenerate"]=> int(1524320738) ["ticket_order_1448937565"]=> array(14) { ["validation_rules"]=> array(3) { ["ticket_holder_first_name06"]=> string(8) "required" ["ticket_holder_last_name06"]=> string(8) "required" ["ticket_holder_email06"]=> string(20) "required|valid_email" } ["validation_messages"]=> array(3) { ["ticket_holder_first_name06"]=> array(1) { ["required"]=> string(40) "Ticket holder 1's first name is required" } ["ticket_holder_last_name06"]=> array(1) { ["required"]=> string(39) "Ticket holder 1's last name is required" } ["ticket_holder_email06"]=> array(2) { ["required"]=> string(35) "Ticket holder 1's email is required" ["valid_email"]=> string(37) "Ticket holder 1's email must be valid" } } ["event_id"]=> string(1) "7" ["tickets"]=> array(1) { [0]=> array(6) { ["ticket"]=> object(App\Icon\Entities\Tickets\Ticket)#164 (28) { ["ticket_id":protected]=> string(1) "6" ["ticket_event":protected]=> string(1) "7" ["ticket_title":protected]=> string(7) "Another" ["ticket_description":protected]=> string(0) "" ["event_venue_name":protected]=> NULL ["ticket_user":protected]=> string(1) "1" ["event_is_live":protected]=> NULL ["event_venue_name_full":protected]=> NULL ["ticket_quantity_available":protected]=> string(2) "20" ["ticket_max_per_person":protected]=> string(2) "30" ["ticket_start_sale_date":protected]=> string(19) "2018-02-28 17:00:00" ["ticket_end_sale_date":protected]=> NULL ["ticket_created_at":protected]=> string(19) "2018-03-09 15:54:08" ["ticket_updated_at":protected]=> string(19) "2018-04-19 21:13:50" ["ticket_deleted":protected]=> string(1) "0" ["ticket_is_hidden":protected]=> string(1) "0" ["ticket_price":protected]=> string(6) "400.00" ["ticket_is_paused":protected]=> string(1) "0" ["ticket_sort_order":protected]=> string(1) "2" ["ticket_organiser_fees_volume":protected]=> string(4) "0.00" ["ticket_quantity_sold":protected]=> string(1) "0" ["ticket_sales_volume":protected]=> string(4) "0.00" ["ticket_status":protected]=> NULL ["_options":protected]=> array(3) { ["datamap"]=> array(0) { } ["dates"]=> array(4) { [0]=> string(17) "ticket_created_at" [1]=> string(17) "ticket_updated_at" [2]=> string(22) "ticket_start_sale_date" [3]=> string(20) "ticket_end_sale_date" } ["casts"]=> array(0) { } } ["relatives":protected]=> array(0) { } ["ticket_edited_by"]=> NULL ["ticket_min_per_person"]=> string(1) "1" ["ticket_public_id"]=> NULL } ["qty"]=> int(1) ["price"]=> float(400) ["booking_fee"]=> float(0) ["organiser_booking_fee"]=> float(0) ["full_price"]=> float(400) } } ["total_ticket_quantity"]=> int(1) ["order_started"]=> int(1524320738) ["expires"]=> object(Carbon\Carbon)#150 (3) { ["date"]=> string(26) "2018-04-21 15:35:38.759239" ["timezone_type"]=> int(3) ["timezone"]=> string(12) "Africa/Lagos" } ["reserved_tickets_id"]=> int(13) ["order_total"]=> float(400) ["booking_fee"]=> float(0) ["organiser_booking_fee"]=> float(0) ["total_booking_fee"]=> float(0) ["order_requires_payment"]=> bool(true) ["event_owner"]=> string(1) "1" } } but after the redirect, here is what is left PHP Code: array(1) { ["__ci_last_regenerate"]=> int(1524320922) } note, the redirect is done with ajax. below is the code from the setting of the session downward. PHP Code: /* RE: Lost session - dave friend - 04-21-2018 I think you are asking the right question. Something in the session config is not correct resulting in "lost" sessions. I'm not truely up to speed with CI 4 but I think your $sessionDriver value looks wrong. Try this. PHP Code: public $sessionDriver = 'files'; And as @InsiteFX suggests, make sure the file path is correct. Of particular importance is that only absolute paths are supported for $sessionSavePath. |