Goal: for a given fatal error log event, build an identity string for the error which correlates the same error across multiple mediawiki versions.
Determine the file & line number where the error occurred, by parsing the stack trace and other relevant information from the log event. For the identity string, drop the version number and the last digit of the line number, but keep the function name from the stack trace.
So for example, I propose to grab the bold sections from the following stack trace frame:
#0 /srv/mediawiki/php-1.34.0-wmf.11/vendor/wikibase/data-model/src/Entity/EntityId.php(138): {closure}(integer)
[1] [2] [3]
- filename
- line number
- function/arguments
This, plus the error message string can be hashed to produce a unique id which should be consistent across instances of the same error, even across multiple versions of the mediawiki code, assuming that the code hasn't changed significantly across versions.
Once the identity hash is built, it can be used to submit tasks to phabricator and to look up tasks in phabricator.