Are you certain it's Moodle 4.2.3? Because on line 231 of /login/index.php
for all versions of Moodle 4.2.x is a comment with the line you reference on line 229:
229 $urltogo = core_login_get_return_url();
230
231 /// check if user password has expired
This difference in line numbers suggests you either have at least 1
source code files from different versions of Moodle, or that your
/login/index.php
has been modified. Make sure you have the correct
source code files for the expected version of Moodle.
Also, the correct /login/index.php
contains:
28 require_once('lib.php');
which loads the file containing
the definition for core_login_get_return_url()
so there should never be a
Call to undefined function core_login_get_return_url() error.