From 38fd1a794d4eb6b613f4ec3771190072246b3ef0 Mon Sep 17 00:00:00 2001 From: C1-10P Date: Fri, 20 Jul 2018 15:15:51 +0200 Subject: [PATCH] Update NativeState.php sync garbage collection cycle of KerberosAuth and NativeState --- src/Native/NativeState.php | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/src/Native/NativeState.php b/src/Native/NativeState.php index 179ba95..043a3d8 100644 --- a/src/Native/NativeState.php +++ b/src/Native/NativeState.php @@ -34,6 +34,10 @@ class NativeState { protected $handlerSet = false; protected $connected = false; + + // sync the garbage collection cycle + // __deconstruct() of KerberosAuth should not called too soon + protected $auth; // see error.h const EXCEPTION_MAP = [ @@ -85,6 +89,11 @@ class NativeState { $this->state = smbclient_state_new(); smbclient_option_set($this->state, SMBCLIENT_OPT_AUTO_ANONYMOUS_LOGIN, false); $auth->setExtraSmbClientOptions($this->state); + + // sync the garbage collection cycle + // __deconstruct() of KerberosAuth should not called too soon + $this->auth = $auth; + $result = @smbclient_state_init($this->state, $auth->getWorkgroup(), $auth->getUsername(), $auth->getPassword()); $this->testResult($result, '');