Yealink legacy config style with an associated extension fails to write provisioning files (Reproducible)

FreePBX 17.0.19.16. Reproducible, even on re-installation. Edge package also affected.

Yealink template, legacy style with a T42S model selected. Once template is associated with an extension, the provisioning config for the phone will never be written showing the following error:

In functions_yealink.php line 906:

[Whoops\Exception\ErrorException (2)]
Undefined variable $base

Exception trace:
at /var/www/html/admin/modules/endpoint/functions.inc/functions_yealink.php:906
Whoops\Run->handleError() at /var/www/html/admin/modules/endpoint/functions.inc/functions_yealink.php:906
endpoint_yealink_basefile_legacy() at /var/www/html/admin/modules/endpoint/functions.inc/functions_yealink.php:213
endpoint_write_yealink_ext() at /var/www/html/admin/modules/endpoint/functions.inc/functions_common.php:69
endpoint_write_ext() at /var/www/html/admin/modules/endpoint/Endpoint.class.php:524
FreePBX\modules\Endpoint->endpointRebuild() at /var/www/html/admin/modules/endpoint/Console/Endpoint.class.php:96
FreePBX\Console\Command\Endpoint->execute() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Command/Command.php:312
Symfony\Component\Console\Command\Command->run() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:1022
Symfony\Component\Console\Application->doRunCommand() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:314
Symfony\Component\Console\Application->doRun() at /var/www/html/admin/libraries/Composer/vendor/symfony/console/Application.php:168
Symfony\Component\Console\Application->run() at /var/lib/asterisk/bin/fwconsole:163

endpoint [-d|–detail] [–brand BRAND] [–mac MAC] [–template TEMPLATE] [–model MODEL] [–account ACCOUNT] [–accessory ACCESSORY] [–vpn VPN] [–restartAsterisk RESTARTASTERISK] [–] […]