diff --git a/extensions/mutex/composer.json b/extensions/mutex/composer.json index 4499543..db8cde3 100644 --- a/extensions/mutex/composer.json +++ b/extensions/mutex/composer.json @@ -22,6 +22,6 @@ "yiisoft/yii2": "*" }, "autoload": { - "psr-0": { "yii\\smarty": "" } + "psr-0": { "yii\\mutex": "" } } } diff --git a/extensions/mutex/yii/mutex/Mutex.php b/extensions/mutex/yii/mutex/Mutex.php index 5268d86..14ebf8f 100644 --- a/extensions/mutex/yii/mutex/Mutex.php +++ b/extensions/mutex/yii/mutex/Mutex.php @@ -33,7 +33,13 @@ abstract class Mutex extends Component public function init() { if ($this->autoRelease) { - register_shutdown_function(array($this, 'shutdownFunction')); + $referenceHolder = new stdClass(); + $referenceHolder->locks = &$this->_locks; + register_shutdown_function(function ($ref) { + foreach ($ref->locks as $lock) { + $this->release($lock); + } + }, $referenceHolder); } } @@ -42,9 +48,7 @@ abstract class Mutex extends Component */ public function shutdownFunction() { - foreach ($this->_locks as $lock) { - $this->release($lock); - } + } /** diff --git a/extensions/mutex/yii/mutex/cache/Mutex.php b/extensions/mutex/yii/mutex/cache/Mutex.php index 67b6445..73e277b 100644 --- a/extensions/mutex/yii/mutex/cache/Mutex.php +++ b/extensions/mutex/yii/mutex/cache/Mutex.php @@ -74,7 +74,7 @@ class Mutex extends \yii\mutex\Mutex */ protected function getIsAcquired($name) { - + } /**