Warning passing null to substr in Tracker/PageUrl.php

On a self hosted matomo, I irregularly have the following warning on the home page (index.php?module=CoreHome&action=index&idSite=1&period=range&date=last7#?period=range&date=last7&idSite=1&category=Dashboard_Dashboard&subcategory=1) :

WARNING: /core/Tracker/PageUrl.php(396): Deprecated - substr(): Passing null to parameter #1 ($string) of type string is deprecated - Matomo 5.6.2 - Please report this message in the Matomo forums: ``https://forum.matomo.org`` (please do a search first as it might have been reported already) (Module: API, Action: get, Method: VisitsSummary.get, In CLI mode: false)

When it appears, it is listed 4 times in yellow panels before the page’s content.

I could not find any related logs.

It appears irregularly : sometimes 2 times in a row, sometimes it doesnt appear for a lot of calls.

1 Like

I am seeing similar warnings on a self-hosted Matomo instance. The warnings appeared right after updating from Matomo 5.6.1 to 5.6.2 and they are still present in the newest version (5.7.1).

A sample of the warnings from the logs:

WARNING CustomDimensions[2026-02-06 12:46:30 UTC] [1826510] /data/matomo/core/Tracker/PageUrl.php(396): Deprecated - substr(): Passing null to parameter #1 ($string) of type string is deprecated - Matomo 5.7.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) [internal function]: Piwik\ErrorHandler::errorHandler(),#1/core/Tracker/PageUrl.php(396),#2/plugins/CustomDimensions/RecordBuilders/CustomDimension.php(229),#3/plugins/CustomDimensions/RecordBuilders/CustomDimension.php(80),#4/core/ArchiveProcessor/RecordBuilder.php(99),#5/core/Plugin/Archiver.php(217),#6/core/ArchiveProcessor/PluginsArchiver.php(186),#7/core/ArchiveProcessor/Loader.php(328),#8/core/ArchiveProcessor/Loader.php(201),#9/core/ArchiveProcessor/Loader.php(180)

It looks like #2/plugins/CustomDimensions/RecordBuilders/CustomDimension.php(229) was last changed in the pull request “Improve rollup ranking queries #23868” (commit 7c16e03b6bbd357d92dd3a32ee055ed0bc7e83d7). According to the changelog, this pull request was closed in 5.6.2.

This is still an issue in 5.8.0:

[13-Apr-2026 09:32:14 UTC] WARNING CustomDimensions[2026-04-13 09:32:14 UTC] [9964] /var/www/html/core/Tracker/PageUrl.php(396): Deprecated - substr(): Passing null to parameter #1 ($string) of type string is deprecated - Matomo 5.8.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) [internal function]: Piwik\\ErrorHandler::errorHandler(),#1/core/Tracker/PageUrl.php(396),#2/plugins/CustomDimensions/RecordBuilders/CustomDimension.php(229),#3/plugins/CustomDimensions/RecordBuilders/CustomDimension.php(80),#4/core/ArchiveProcessor/RecordBuilder.php(94),#5/core/Plugin/Archiver.php(217),#6/core/ArchiveProcessor/PluginsArchiver.php(186),#7/core/ArchiveProcessor/Loader.php(328),#8/core/ArchiveProcessor/Loader.php(201),#9/core/ArchiveProcessor/Loader.php(180)                                                                                                                                                                                                                                                              

I can confirm that the issue persists in 5.8.0. The warning is the same as in my earlier message:
WARNING CustomDimensions[2026-04-20 08:21:56 UTC] [3296715] /data/matomo/core/Tracker/PageUrl.php(396): Deprecated - substr(): Passing null to parameter #1 ($string) of type string is deprecated - Matomo 5.8.0 - Please report this message in the Matomo forums: https://forum.matomo.org (please do a search first as it might have been reported already) [internal function]: Piwik\ErrorHandler::errorHandler(),#1/core/Tracker/PageUrl.php(396),#2/plugins/CustomDimensions/RecordBuilders/CustomDimension.php(229),#3/plugins/CustomDimensions/RecordBuilders/CustomDimension.php(80),#4/core/ArchiveProcessor/RecordBuilder.php(94),#5/core/Plugin/Archiver.php(217),#6/core/ArchiveProcessor/PluginsArchiver.php(186),#7/core/ArchiveProcessor/Loader.php(328),#8/core/ArchiveProcessor/Loader.php(201),#9/core/ArchiveProcessor/Loader.php(180).

This kind of a warning is repeated in the log a few hundred thousand times a day, which is rather concerning.

Hey, yeah I’ve seen this kind of warning pop up in Matomo setups before — kinda annoying because it shows up randomly and clutters the dashboard, right?

I faced something similar on a self-hosted instance where PHP 8.x started throwing those “passing null to substr() is deprecated” notices. Basically what’s happening is some API response (looks like VisitsSummary.get in your case) is sending a null value for a URL string, and Matomo 5.6.2 isn’t handling it cleanly.

What worked for me:

  • First thing, make sure you’re on the latest Matomo patch version (these bugs often get small fixes)

  • Check if any plugin is modifying PageUrl data — one bad plugin can trigger this randomly

  • If possible, enable proper PHP error logging instead of displaying warnings on UI (keeps dashboard clean)

In my setup, it stopped after updating + disabling one outdated tracking plugin. Not 100% sure if your case is identical, but usually it’s data inconsistency, not dashboard itself.

I’ve seen similar edge cases in analytics setups while working around Dooflixtracking dashboards too.

Does it happen after a specific campaign or traffic source, or completely random in your case?

I have the latest Matomo patch version (5.10.1) and the warning still persists.

I checked that only one third-party plugin is installed and that one does not touch PageUrl data. The rest of the plugins are Core/Official. Thus, it looks like the problem is not caused by a plugin.

The warnings seem to happen during scheduled core:archive runs, as suggested by the ArchiveProcessor paths in the warning message.


I had a brief look at the code. It looks like Tracker\PageUrl::normalizeUrl can be called with an empty or null $url parameter in /plugins/CustomDimensions/RecordBuilders/CustomDimension.php line 229 (on the current 5.x-dev branch, commit 9d9a7cbbc785ac0c38c72099210a0ea8aeed6eba). This may happen if $withRollup is falsey because $url is only tested for null value if $withRollup is truthy (line 213).

Before this commit, the $url variable was tested for an empty value right after assignment (same file, line 220, commit 4298579adcaf0edc33d3a4e599f88c155092f436). The change was introduced in Matomo 5.6.2, which is when the warning appeared as well.

I am not sure how this should be fixed. Just check for empty($url) right after $url assignment and continue if it’s empty? Not sure if it’s enough. I guess I have to create a GitHub issue.