Archiving undefined constant IPtoCompany FILTER_SANITIZE_MAGIC_QUOTES error

Hey, I got the following error while running the archiving.

INFO [2023-08-23 23:01:18] 2429 Scheduler: executing task Piwik\Plugins\IPtoCompany\Tasks.getListOfCompaniesThatVisitedWebsiteYesterday_1...
WARNING [2023-08-23 23:01:18] 2429 /var/www/html/plugins/IPtoCompany/UserSettings.php(48): Deprecated - Constant FILTER_SANITIZE_STRING is deprecated - Matomo 4.15.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
Uncaught exception in /var/www/html/plugins/IPtoCompany/API.php line 294:
Undefined constant "Piwik\Plugins\IPtoCompany\FILTER_SANITIZE_MAGIC_QUOTES"
ERROR [2023-08-23 23:01:18] 2429 Uncaught exception: Error: Undefined constant "Piwik\Plugins\IPtoCompany\FILTER_SANITIZE_MAGIC_QUOTES" in /var/www/html/plugins/IPtoCompany/API.php:294
Stack trace:
#0 /var/www/html/plugins/IPtoCompany/API.php(190): Piwik\Plugins\IPtoCompany\API->insertCompanyDetails(Array)
#1 /var/www/html/plugins/IPtoCompany/API.php(84): Piwik\Plugins\IPtoCompany\API->getIPDetails('2a02:3038:60a::', Array, Array)
#2 [internal function]: Piwik\Plugins\IPtoCompany\API->getCompanies('1', 'day', 'yesterday', false, 200)
#3 /var/www/html/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#4 /var/www/html/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#5 /var/www/html/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#6 /var/www/html/core/API/Request.php(267): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'getCompanies', Array)
#7 /var/www/html/core/API/Request.php(560): Piwik\API\Request->process()
#8 /var/www/html/plugins/IPtoCompany/Tasks.php(46): Piwik\API\Request::processRequest('IPtoCompany.get...', Array)
#9 [internal function]: Piwik\Plugins\IPtoCompany\Tasks->getListOfCompaniesThatVisitedWebsiteYesterday(1)
#10 /var/www/html/core/Scheduler/Scheduler.php(309): call_user_func(Array, 1)
#11 /var/www/html/core/Scheduler/Scheduler.php(154): Piwik\Scheduler\Scheduler->executeTask(Object(Piwik\Scheduler\Task))
#12 /var/www/html/plugins/CoreAdminHome/API.php(75): Piwik\Scheduler\Scheduler->run()
#13 /var/www/html/core/CronArchive.php(659): Piwik\Plugins\CoreAdminHome\API->runScheduledTasks()
#14 /var/www/html/core/CronArchive.php(277): Piwik\CronArchive->runScheduledTasks()
#15 /var/www/html/core/Access.php(661): Piwik\CronArchive->Piwik\{closure}()
#16 /var/www/html/core/CronArchive.php(282): Piwik\Access::doAsSuperUser(Object(Closure))
#17 /var/www/html/plugins/CoreConsole/Commands/CoreArchiver.php(32): Piwik\CronArchive->main()
#18 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreConsole\Commands\CoreArchiver), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/core/Console.php(108): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 [internal function]: Piwik\Console->originDoRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/core/Console.php(147): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/core/Access.php(670): Piwik\Console->Piwik\{closure}()
#25 /var/www/html/core/Console.php(148): Piwik\Access::doAsSuperUser(Object(Closure))
#26 /var/www/html/core/Console.php(87): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /var/www/html/console(32): Symfony\Component\Console\Application->run()
#29 {main}

I can see it has something to do with the IPToCompany plugin. My version of it is v1.2.2

Instance:

Running in Docker
Matomo-Version: 4.15.1
MySQL-Version: 11.0.3-MariaDB-1:11.0.3+maria~ubu2204
PHP-Version: 8.1.22

No idea? My cronjob which is set to the first of the month failed again with this error:

WARNING [2023-08-31 22:00:04] 30614  /var/www/html/plugins/IPtoCompany/UserSettings.php(48): Deprecated - Constant FILTER_SANITIZE_STRING is deprecated - Matomo 4.15.1 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already)
Uncaught exception in /var/www/html/plugins/IPtoCompany/API.php line 294:
Undefined constant "Piwik\Plugins\IPtoCompany\FILTER_SANITIZE_MAGIC_QUOTES"
ERROR [2023-08-31 22:00:11] 30614  Uncaught exception: Error: Undefined constant "Piwik\Plugins\IPtoCompany\FILTER_SANITIZE_MAGIC_QUOTES" in /var/www/html/plugins/IPtoCompany/API.php:294
Stack trace:
#0 /var/www/html/plugins/IPtoCompany/API.php(190): Piwik\Plugins\IPtoCompany\API->insertCompanyDetails(Array)
#1 /var/www/html/plugins/IPtoCompany/API.php(84): Piwik\Plugins\IPtoCompany\API->getIPDetails('2a02:810b:4240:...', Array, Array)
#2 [internal function]: Piwik\Plugins\IPtoCompany\API->getCompanies('1', 'day', 'yesterday', false, 200)
#3 /var/www/html/core/API/Proxy.php(244): call_user_func_array(Array, Array)
#4 /var/www/html/core/Context.php(28): Piwik\API\Proxy->Piwik\API\{closure}()
#5 /var/www/html/core/API/Proxy.php(335): Piwik\Context::executeWithQueryParameters(Array, Object(Closure))
#6 /var/www/html/core/API/Request.php(267): Piwik\API\Proxy->call('\\Piwik\\Plugins\\...', 'getCompanies', Array)
#7 /var/www/html/core/API/Request.php(560): Piwik\API\Request->process()
#8 /var/www/html/plugins/IPtoCompany/Tasks.php(46): Piwik\API\Request::processRequest('IPtoCompany.get...', Array)
#9 [internal function]: Piwik\Plugins\IPtoCompany\Tasks->getListOfCompaniesThatVisitedWebsiteYesterday(1)
#10 /var/www/html/core/Scheduler/Scheduler.php(309): call_user_func(Array, 1)
#11 /var/www/html/core/Scheduler/Scheduler.php(154): Piwik\Scheduler\Scheduler->executeTask(Object(Piwik\Scheduler\Task))
#12 /var/www/html/plugins/CoreAdminHome/API.php(75): Piwik\Scheduler\Scheduler->run()
#13 /var/www/html/core/CronArchive.php(659): Piwik\Plugins\CoreAdminHome\API->runScheduledTasks()
#14 /var/www/html/core/CronArchive.php(277): Piwik\CronArchive->runScheduledTasks()
#15 /var/www/html/core/Access.php(661): Piwik\CronArchive->Piwik\{closure}()
#16 /var/www/html/core/CronArchive.php(282): Piwik\Access::doAsSuperUser(Object(Closure))
#17 /var/www/html/plugins/CoreConsole/Commands/CoreArchiver.php(32): Piwik\CronArchive->main()
#18 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Command/Command.php(257): Piwik\Plugins\CoreConsole\Commands\CoreArchiver->execute(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#19 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(874): Symfony\Component\Console\Command\Command->run(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#20 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(195): Symfony\Component\Console\Application->doRunCommand(Object(Piwik\Plugins\CoreConsole\Commands\CoreArchiver), Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#21 /var/www/html/core/Console.php(108): Symfony\Component\Console\Application->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#22 [internal function]: Piwik\Console->originDoRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#23 /var/www/html/core/Console.php(147): call_user_func(Array, Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#24 /var/www/html/core/Access.php(670): Piwik\Console->Piwik\{closure}()
#25 /var/www/html/core/Console.php(148): Piwik\Access::doAsSuperUser(Object(Closure))
#26 /var/www/html/core/Console.php(87): Piwik\Console->doRunImpl(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#27 /var/www/html/vendor/symfony/console/Symfony/Component/Console/Application.php(126): Piwik\Console->doRun(Object(Symfony\Component\Console\Input\ArgvInput), Object(Symfony\Component\Console\Output\ConsoleOutput))
#28 /var/www/html/console(32): Symfony\Component\Console\Application->run()
#29 {main}

It happen to me too, using matomo 4.16.0 and the newest 8.3 version of php.
With the 7.4 or 8.2 versions of php it does not display this error.

But it is a plugin - IPtoCompany - maybe something that the devolper haven’t tested yet under 8.3 php version?

Thanks, Pedro

1 Like