0

I have version 8.1.3 of PHP and I am getting the following error message on Magento 2.4.4:

    Exception #0 (Exception): Deprecated Functionality: strtotime(): Passing null to parameter #1 ($datetime) 
of type string is deprecated in /data/web/magento2/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php on line 259

on the homepage, category pages etc. Have you faced this issue before ? Do you have any suggestions how to fix it ?

Thank you

3 Answers 3

0

I think you are missing both these things

  • PHP fpm all extensions
  • Composer version

You can also rename the vendor and update the composer.

2
  • not sure if what you said has any impact on the issue described. Can you add some more details ? Please note that on PHP 7.4 this doesn't occur. Commented Jul 22, 2022 at 18:33
  • I think this link may be helpful for you: github.com/magento/magento2/issues/34531. You can also check my deleting the vendor directory and run the composer update. If it is a fresh installation, you can fix this issue by the above related solutions
    – Rana Zain
    Commented Jul 22, 2022 at 20:41
0

Sorry i can't understand why this issue getting in core modules but i was facing same issue like PHP Deprecated: explode():. So i have found temporary solution for it.

Below is that us my issue solution.

$comp_uids = explode(',', $result['comp_uids'] ?? '');

And i am not sure about you issue but try below solution once time.

return strtotime($date) ?? '';

Check below links:

https://stackoverflow.com/questions/71707325/migration-to-php-8-1-how-to-fix-deprecated-passing-null-to-parameter-error-r

https://stackoverflow.com/questions/71097927/php-8-1-explode-passing-null-to-parameter-2-string-of-type-string-is-de

Thanks.

0

I hope this answer helps you

The main problem that causes this error is that somewhere there is a use of strtotime() function, but the param passed is null. I think you need to check the log to know exactly where the problem is, or start debugging from /data/web/magento2/lib/internal/Magento/Framework/Stdlib/DateTime/Timezone.php on line 259.

You can use debug backtrace to log and find it easier

$writer = new \Zend_Log_Writer_Stream(BP . '/var/log/custom.log');
$logger = new \Zend_Log();
$logger->addWriter($writer);
$debugBackTrace = debug_backtrace(DEBUG_BACKTRACE_IGNORE_ARGS);
foreach ($debugBackTrace as $item) {
    $logger->info(@$item['class'] . @$item['type'] . @$item['function']);
}

Then reload your page and check file custom.log in folder /data/web/magento2/var/log/

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.