This is the relevant code. Others have faced similar issues on stack overflow but tried a couple of those solutions and didn't seem to work in this case. It seems part of the code needs to be stored in a variable and then that variable stored in $path.
$path = ltrim( end( @explode( get_template(), str_replace( '\\', '/', dirname( __FILE__ ) ) ) ), '/' );
This is occurring on the latest version on Ubuntu.