From 6d0ef4111a2848ec0a90caad7dfc7c2a7dfc5771 Mon Sep 17 00:00:00 2001 From: Tim Otten Date: Mon, 9 Feb 2015 12:44:30 -0800 Subject: [PATCH] DynamicFKAuthorization - Fix for PHP 5.3 --- Civi/API/Subscriber/DynamicFKAuthorization.php | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/Civi/API/Subscriber/DynamicFKAuthorization.php b/Civi/API/Subscriber/DynamicFKAuthorization.php index 7e674c8b17..87b278066b 100644 --- a/Civi/API/Subscriber/DynamicFKAuthorization.php +++ b/Civi/API/Subscriber/DynamicFKAuthorization.php @@ -60,8 +60,10 @@ class DynamicFKAuthorization implements EventSubscriberInterface { /** * @var \Civi\API\Kernel + * + * Treat as private. Marked public due to PHP 5.3-compatibility issues. */ - protected $kernel; + public $kernel; /** * @var string, the entity for which we want to manage permissions @@ -219,7 +221,8 @@ class DynamicFKAuthorization implements EventSubscriberInterface { * @var \Exception $exception */ $exception = NULL; - \CRM_Core_Transaction::create(TRUE)->run(function($tx) use ($entity, $action, $entityId, &$exception) { + $self = $this; + \CRM_Core_Transaction::create(TRUE)->run(function($tx) use ($entity, $action, $entityId, &$exception, $self) { $tx->rollback(); // Just to be safe. $params = array( @@ -228,7 +231,7 @@ class DynamicFKAuthorization implements EventSubscriberInterface { 'id' => $entityId, ); - $result = $this->kernel->run($entity, $this->getDelegatedAction($action), $params); + $result = $self->kernel->run($entity, $self->getDelegatedAction($action), $params); if ($result['is_error'] || empty($result['values'])) { $exception = new \Civi\API\Exception\UnauthorizedException("Authorization failed on ($entity,$entityId)", array( 'cause' => $result, -- 2.25.1