0

I have Issue Display Out of Stock Products when enabled. Some link category menu are crashed.

Deprecated Functionality: preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in /home/851015.cloudwaysapps.com/ftfwgauhdu/public_html/vendor/magento/zendframework1/library/Zend/Db/Statement.php on line 222

I have tried to disable every extension installed but the issue persist-

Can you help me please

Regards Robertoenter image description here

3
  • This is deprecated error, you can fix it by running composer update, make sure to backup your code. can you tell what is your magento's version? May 11, 2023 at 13:59
  • 1
    Which PHP version and Magento version are you using? May 12, 2023 at 7:37
  • Seems like you have installed a version of PHP greater then the supported version of you r Magento version. You may have to downgrade your PHP or upgrade your Magento. May 18, 2023 at 10:51

1 Answer 1

0

The error message you provided indicates a deprecated functionality warning related to the preg_replace() function in the Zend/Db/Statement.php file. This warning is usually logged when Magento encounters code that uses deprecated features.

To resolve this issue, you can apply the following steps:

  1. Check PHP Version: Ensure that your PHP version meets the requirements of your Magento version. Make sure you are using a supported PHP version.
  2. Update Magento: If you are using an older version of Magento, consider updating to a more recent version. Newer versions often address bugs and compatibility issues.
  3. Update Dependencies: Make sure your Magento installation has up-to-date dependencies. You can run the following command from your Magento root directory to update them:

composer update

  1. Review Customizations: If you have any custom code or extensions, review them for any usages of preg_replace() that might be passing null as the third parameter. Update the code to provide a valid subject to preg_replace(), either an array or a string.
  2. Error Reporting: Enable error reporting and logging in Magento to get more detailed information about the error. You can do this by navigating to the Magento Admin Panel: Stores > Configuration > Advanced > Developer > Debug > Enable Error Reporting and Enable Developer Mode.
  3. Debugging: If the issue persists, you can debug the problem further by adding var_dump() or print_r() statements in the Statement.php file at line 222 to inspect the values being passed to preg_replace(). This can help identify the cause of the error.

Remember to clear the Magento cache after making any changes or updates.

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.