Fixed ErrorException: [E_DEPRECATED] str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in


Affected version
I think this error is caused by PHP 8.1
ErrorException: [E_DEPRECATED] str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated in src/XF/Job/AddOnUninstallData.php at line 76
  1. XF::handlePhpError()
  2. str_replace() in src/XF/Job/AddOnUninstallData.php at line 76
  3. XF\Job\AddOnUninstallData->getStatusMessage() in src/XF/Admin/Controller/Tools.php at line 176
  4. XF\Admin\Controller\Tools->actionRunJob() in src/XF/Mvc/Dispatcher.php at line 352
  5. XF\Mvc\Dispatcher->dispatchClass() in src/XF/Mvc/Dispatcher.php at line 259
  6. XF\Mvc\Dispatcher->dispatchFromMatch() in src/XF/Mvc/Dispatcher.php at line 115
  7. XF\Mvc\Dispatcher->dispatchLoop() in src/XF/Mvc/Dispatcher.php at line 57
  8. XF\Mvc\Dispatcher->run() in src/XF/App.php at line 2351
  9. XF\App->run() in src/XF.php at line 517
  10. XF::runApp() in admin.php at line 13
@NixFifty I too have similar error popped up when I'm submitted a post with custom fields. This error only appears when add-on "Thread Filter by AddonsLab" is used and debug mode is turned on.

PHP version 8.1.7
MySQL version10.3.35 (10.3.35-MariaDB)Server software

ErrorException: [E_DEPRECATED] preg_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated src/XF/Search/Source/MySqlFt.php:425
Generated by: admin Jun 19, 2022 at 5:52 AM
Stack trace
#0 [internal function]: XF::handlePhpError(8192, '[E_DEPRECATED] ...', '/home/nginx/dom...', 425)
#1 src/XF/Search/Source/MySqlFt.php(425): preg_replace('/[^a-z0-9_]/i', '', NULL)
#2 src/XF/Search/Source/MySqlFt.php(36): XF\Search\Source\MySqlFt->getMetadataKey('field_location_...', NULL)
#3 src/XF/Search/Search.php(42): XF\Search\Source\MySqlFt->index(Object(XF\Search\IndexRecord))
#4 src/XF/Behavior/Indexable.php(48): XF\Search\Search->index('thread_field', Object(AL\ThreadFilter\Entity\ThreadFieldIndex), false)
#5 src/XF.php(377): XF\Behavior\Indexable->XF\Behavior\{closure}()
#6 src/XF/Mvc/Dispatcher.php(158): XF::triggerRunOnce(true)
#7 src/XF/Mvc/Dispatcher.php(57): XF\Mvc\Dispatcher->dispatchLoop(Object(XF\Mvc\RouteMatch))
#8 src/XF/App.php(2352): XF\Mvc\Dispatcher->run()
#9 src/XF.php(524): XF\App->run()
#10 index.php(20): XF::runApp('XF\\Pub\\App')
#11 {main}

Is it the problem of XF2.2.9 or is it the compatibility issue of the add-on and PHP 8.1.7?
Top Bottom