Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

setPasswordCreatedAt() leads to PHP Warning #2285

Closed
imaphpdev opened this issue Jul 8, 2022 · 0 comments · Fixed by #2318
Closed

setPasswordCreatedAt() leads to PHP Warning #2285

imaphpdev opened this issue Jul 8, 2022 · 0 comments · Fixed by #2318

Comments

@imaphpdev
Copy link

imaphpdev commented Jul 8, 2022

Preconditions (*)

  1. OpenMage 1.9.4.16

Steps to reproduce (*)

  1. Register while running through the onepage checkout

Expected result (*)

  1. no log inside system.log
  2. correct value for customer-attribute "password_created_at" in table "customer_entity_int"

Actual result (*)

  1. "Warning: Trying to access array offset on value of type null in app/code/core/Mage/Checkout/Model/Type/Onepage.php on line 733" is logged in system.log
  2. customer-attribute "password_created_at" in table "customer_entity_int" has a negative value (depends on value for cookie-lifetime)

Solution

$passwordCreatedTime = $this->_checkoutSession->getData('_session_validator_data')['session_expire_timestamp']
            - Mage::getSingleton('core/cookie')->getLifetime();
$customer->setPasswordCreatedAt($passwordCreatedTime);

Was added with magento patch SUPEE-10752.

Correct shuold be

$customer->setPasswordCreatedAt(time());

(see all the other usages of setPasswordCreatedAt())

@imaphpdev imaphpdev added the bug label Jul 8, 2022
@elidrissidev elidrissidev mentioned this issue Jul 15, 2022
4 tasks
@elidrissidev elidrissidev linked a pull request Jul 15, 2022 that will close this issue
4 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants