Ich bin in ein wirklich seltsames Problem, wo ich eine Undefined variable: authenticated_function
Ausnahme sofort nach dem Passieren eines isset()
Anruf ausgelöst wird. Code:Private statische Variable undefined unmittelbar nach dem Übergeben isset()
class AuthService
{
static $authenticated_function;
public static function setAuthenticatedFunction($func)
{
\Log::info("Function Set");
self::$authenticated_function = $func;
}
public function authenticated()
{
\Log::info("ISSET: " . isset(self::$authenticated_function));
var_dump(self::$authenticated_function);
if(isset(self::$authenticated_function))
self::$authenticated_function(); //Exception is thrown here
}
}
In meiner Protokolldatei:
[2016-12-19 19:05:08] local.INFO: Function Set
[2016-12-19 19:05:08] local.INFO: ISSET: 1
Und die var_dump()
:
object(Closure)[103]
public 'this' =>
object(App\Providers\AppServiceProvider)[86]
... //Removed for brevity
protected 'defer' => boolean false
PHP 7.0.8
Laravel 5.3