My project information:
- Phalcon framework
- PHP 7.2
- PHP vlucas/phpdotenv
My page loses all session (shopping cart, user login...) when page redirects from E-xact Gateway after customer did purchasing. This issues didn't happen before. It happened after integrating phpdotenv into my project.
Scenario 1:
- Start page: session file name AAA
- Cart was empty, I added item and do purchasing, after page redirected from E-xact (payment successfully). All page's sessions were gone. Session file BBB was created and of course it was empty.
- On session file BBB, logged in again, go back to cart and do purchasing again for the item that I already added before and it was successful.
Scenario 2:
- On session file BBB, I did adding cart, payment again as same as Scenario 1. It was created session file CCC and went back the problem as Scenario 1.
I tried: (but the issues still happens)
- Truncate my databases.
- Clear all session's files
- Installing new project
- Change session.gc_maxlifetime 1440 to session.gc_maxlifetime 3600
- Comment phpdotenv
- Comment all $this->session->destroy().
- Send and get session back by session ID:
logger("SSID before: ".$this->session->getId(), 0);
$ssId = $this->request->getQuery("ssId");
session_id($ssId);
session_start();
logger("SSID after: ".$this->session->getId(), 0);
// Log info
[INFO][2020/08/24 10:27:22 AM]: SSID before: 82119875f4e94fbf4d34a5d14515c5c9
[INFO][2020/08/24 10:27:22 AM]: SSID after: 8229b3e8e644c5a3b7a8c89ab0a9c778
[INFO][2020/08/24 10:27:49 AM]: SSID before: 82119875f4e94fbf4d34a5d14515c5c9
[INFO][2020/08/24 10:27:49 AM]: SSID after: 82119875f4e94fbf4d34a5d14515c5c9
My initial script for session
$di->setShared('session', function () {
$session = new SessionAdapter();
$session->start();
return $session;
});
I know that I am facing this issue because Phalcon created new session file after redirecting from another page. However, I din't know how and when does Phalcon framework create new session file?
Does anyone have any ideas?