Using PHP 8.3 (or 8.1), CS-Cart v 4.20
When submitting the Contact Us form.
Bug Tracker reports these four warnings:
PHP Deprecated: strpos(): Passing null to parameter #1 ($haystack) of type string is deprecated in app/addons/product_variations/src/HookHandlers/SeoHookHandler.php on line 54
PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in app/functions/fn.common.php on line 4019
PHP Deprecated: preg_match(): Passing null to parameter #2 ($subject) of type string is deprecated in app/functions/fn.common.php on line 3999
PHP Deprecated: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in app/functions/fn.common.php on line 3912
I don’t know why the addon for product variations would even be included here, but it is. I don’t even use product variations.
This isn’t a bug in the store, but rather a warning about code incompatibility with PHP 8.
PHP 7 accepted this without a word, but PHP 8.1 and later reports it as “deprecated.”
The form works correctly, and emails are sent. It can be silenced with a single line in the installation configuration.
I’m aware. PHP 8.1 and any older version is obsolete. PHP 8.3 has been supported since v4.19. But the cart has a few instances of deprecated code and the built in bug tracker will show you them all.
What line do you propose to be edited to silence them? I’m not doing a new installation as I’ve run CS-Cart for 16 years.
I’ve been doing that for years. Deprecated warnings still get reported in debug mode (unless you disable it local_config.php), and they still write to my PHP error log.
I don’t recall in which script CS-Cart includes a function that writes the warnings to the PHP error log regardless of PHP error reporting configuration or config.local settings, but my error log gets about 50k of warnings a day for these deprecated functions (and I don’t even have high traffic):
PHP Deprecated: strip_tags()
PHP Deprecated: html_entity_decode()
PHP Deprecated: strpos()
PHP Deprecated: preg_match()
I fail to see why CS-Cart didn’t search all their code for these functions and update everywhere they are used in the last release.