0

I am working on custom login using below code, before it was working fine now its giving error.

Error:

An uncaught Exception was encountered Type: Mage_Core_Model_Session_Exception Message: (null)

I don't know what caused this error. Please help me to fix this error

Thank you

<?php
function loginUser( $email, $password )
require_once ("app/Mage.php");
umask(0);
ob_start();
session_start();
Mage::app('default');
Mage::getSingleton("core/session", array("name" => "frontend"));

$websiteId = Mage::app()->getWebsite()->getId();
$store = Mage::app()->getStore();
$customer = Mage::getModel("customer/customer");
$customer->website_id = $websiteId;
$customer->setStore($store);
try {
    $customer->loadByEmail($email);
    $session = Mage::getSingleton('customer/session')->setCustomerAsLoggedIn($customer);
    $session->login($email, $password);
}catch(Exception $e){

}


} 
?>
1

1 Answer 1

0

There is a good chance that this issue is related to PHP 7. Could you confirm if any sessions are working on Magento and what PHP version the host server is using?

1
  • Hi. I found the solution, In the backend, I set the cookie time to Zero. but I don't know this is the way to remove this error. Now the error is gone. Thanks. Commented Oct 16, 2018 at 7:46

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.