Per T215126: PHP warning on some Echo email sending attempts due to mismatching PEAR file versions, some files of the Mail_Mime PEAR package are included from the mediawiki/vendor repo (or the Composer-maintained vendor directory, presumably, when one uses Composer in production), other files are from the PEAR package installed as a Debian system package in /usr/share/php. This results in a version mismatch and bugs.
Files in the Mail_Mime PEAR package start with something like
require_once 'PEAR.php'; require_once 'Mail/mimePart.php';
Mail and Mail_Mime use Composer's include-path property:
"include-path": [ "./" ],
so in theory the vendor/pear/mail and vendor/pear/mail-mime subdirectories should be part of the include path but that doesn't seem to be the case:
tgr@mwdebug1002:~$ PHP=php7.2 mwscript shell.php enwiki >>> get_include_path() => "/srv/mediawiki/php-1.33.0-wmf.14:/usr/local/lib/php:/usr/share/php"
(Same result with PHP 5, not sure why the error only seems to be happening with PHP 7.)
Seems like a Composer bug? (Also, those PEAR packages should probably be fixed the way other packages have been.)