• Resolved mattiabf

    (@mattiabf)


    Hello

    I’m experiencing this fatal error on my WordPress site, when certain users try to reset their password:

    Error message:

    Uncaught TypeError: gmdate(): Argument #2 ($timestamp) must be of type ?int, string given in /wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php:791

    WordPress Version: 6.7.2
    Active Theme: WP Astra
    Affected Plugin: WooCommerce (version 9.4.3)
    PHP Version: 8.2.27

    The error occurs in this file:

    /wp-content/plugins/woocommerce/src/Admin/API/Reports/Customers/DataStore.php

    It seems WooCommerce is passing a string instead of an int value to the gmdate() function, causing a type error.

    Additional details:
    The issue does not affect all users, only some users who were imported some time ago using a plugin (I did not do it myself, so I do not know which plugin, or how they were imported).

    When switching back to PHP 7, the error does not occur.

    Have you encountered this issue before? Is there a fix or workaround for WooCommerce on PHP 8?

    Thank you

Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there!

    Thanks for reaching out and for sharing the details.

    The error you’re seeing happens because PHP 8 is stricter about the type of data passed to functions like gmdate(). In this case, it looks like some customer data — likely imported using the plugin you mentioned — contains an invalid date value. This isn’t a general bug in WooCommerce, but rather an issue caused by unexpected data from the import.

    If you know which plugin was used to import the users, the developer of that plugin may also be able to assist. I would suggest you try to manually re-saving an affected user’s profile to see if that helps update their data.

    As a temporary workaround, staying on PHP 7 avoids the error, though we do recommend updating to PHP 8+ when possible.

    Let us know if you have any other questions!

    Thread Starter mattiabf

    (@mattiabf)

    hello

    i understand that the bug is not related to WooCommerce but:

    I do not know the plugin, and I cannot downgrade to previous php version due to server limitations.

    I was just asking for a fix. Can I manually edit DataStore.php to convert the type (I am a developer)?

    can I call some hook somewhere, from functions.php, to convert the type before the this action is performed?

    do I have to run a command in the database to convert the type?

    Thread Starter mattiabf

    (@mattiabf)

    users are more than 2000, so I cannot edit them manually

    Plugin Support shahzeen(woo-hc)

    (@shahzeenfarooq)

    Hi there,

    Thanks for your follow-up and for clarifying the situation.

    As this relates to custom data imported from an unknown source, and given the scope of support we can provide here in the forums, we’re not able to assist with custom code or direct modifications to WooCommerce core files like DataStore.php. Directly editing WooCommerce core files is not recommended, as it could lead to unexpected behavior and would be overwritten during updates.

    If you want to consider professional assistance for customization, I can recommend WooExperts and Codeable.io as options for getting professional help. Alternatively, you can also ask your development questions in the  WooCommerce Community Slack as custom code falls outside our usual scope of support.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘Fatal Error with Password Reset’ is closed to new replies.