The following snippet worked in the plugin for version 8 and 9.
$localTSFE = clone $GLOBALS[\'TSFE\'];
Now while updating to version 10.4, I am receiving the follo