diff --git a/src/Controller/AuditLogsController.php b/src/Controller/AuditLogsController.php index e72327d..00d545e 100644 --- a/src/Controller/AuditLogsController.php +++ b/src/Controller/AuditLogsController.php @@ -8,6 +8,7 @@ use Cake\ORM\TableRegistry; use \Cake\Database\Expression\QueryExpression; use Cake\Http\Exception\UnauthorizedException; use Cake\Core\Configure; +use PhpParser\Node\Stmt\Echo_; class AuditLogsController extends AppController { @@ -22,8 +23,10 @@ class AuditLogsController extends AppController 'filters' => $this->filterFields, 'quickFilters' => $this->quickFilterFields, 'afterFind' => function($data) { - $data['request_ip'] = inet_ntop(stream_get_contents($data['request_ip'])); - $data['changed'] = stream_get_contents($data['changed']); + $request_ip = is_resource($data['request_ip']) ? stream_get_contents($data['request_ip']) : $data['request_ip']; + $change = is_resource($data['change']) ? stream_get_contents($data['change']) : $data['change']; + $data['request_ip'] = inet_ntop($request_ip); + $data['changed'] = $change; return $data; } ]);