Hello:
I enabled the use of PHP in widgets via functions.php. The code I’m using is:
function php_execute($html){
if(strpos($html,"<"."?php")!==false){ ob_start(); eval("?".">".$html);
$html=ob_get_contents();
ob_end_clean();
}
return $html;
}
add_filter(‘widget_text’,‘php_execute’,100);
It has worked great for the past year or so, but I noticed it recently stopped displaying in the admin. The PHP executes, because the front-end of the site is fine. When I go into the widget area and select the widget and text area the PHP is in, it flickers really fast and disappears. There’s no way to edit or remove it. You can only delete the text area and create a new one. In the console, I see this error:

I haven’t done anything to change any parent theme files. Can you point me in the right direction how to fix this?
I found a simliar post here, but didn’t find any resolve: