diff --git a/library/Director/Db/Branch/Branch.php b/library/Director/Db/Branch/Branch.php index 49ec8074..b75a3e6a 100644 --- a/library/Director/Db/Branch/Branch.php +++ b/library/Director/Db/Branch/Branch.php @@ -45,7 +45,7 @@ class Branch if (strlen($row->uuid) !== 16) { throw new RuntimeException('Valid UUID expected, got ' . var_export($row->uuid, 1)); } - $self->branchUuid = Uuid::fromBytes($row->uuid); + $self->branchUuid = Uuid::fromBytes(Db\DbUtil::binaryResult($row->uuid)); $self->name = $row->branch_name; $self->owner = $row->owner; $self->tsMergeRequest = $row->ts_merge_request; diff --git a/library/Director/Db/DbUtil.php b/library/Director/Db/DbUtil.php new file mode 100644 index 00000000..b80c61e5 --- /dev/null +++ b/library/Director/Db/DbUtil.php @@ -0,0 +1,18 @@ +uuid) && is_resource($row->uuid)) { - $row->uuid = stream_get_contents($row->uuid); - } + $row->uuid = DbUtil::binaryResult($row->uuid); if ($this->linkWithName) { $params = ['name' => $row->object_name]; } else { diff --git a/library/Director/Web/Table/ObjectSetTable.php b/library/Director/Web/Table/ObjectSetTable.php index c3ca4557..3e86b4e1 100644 --- a/library/Director/Web/Table/ObjectSetTable.php +++ b/library/Director/Web/Table/ObjectSetTable.php @@ -49,7 +49,7 @@ class ObjectSetTable extends ZfQueryBasedTable $params['id'] = $row->id; } else { $params = [ - 'uuid' => Uuid::fromBytes($row->uuid)->toString(), + 'uuid' => Uuid::fromBytes(Db\DbUtil::binaryResult($row->uuid))->toString(), 'name' => $row->object_name ]; } diff --git a/library/Director/Web/Table/ObjectsTableService.php b/library/Director/Web/Table/ObjectsTableService.php index 4a434521..a03d91a8 100644 --- a/library/Director/Web/Table/ObjectsTableService.php +++ b/library/Director/Web/Table/ObjectsTableService.php @@ -2,6 +2,7 @@ namespace Icinga\Module\Director\Web\Table; +use Icinga\Module\Director\Db\DbUtil; use ipl\Html\Html; use gipfl\IcingaWeb2\Table\Extension\MultiSelect; use gipfl\IcingaWeb2\Link; @@ -50,7 +51,7 @@ class ObjectsTableService extends ObjectsTable public function renderRow($row) { $params = [ - 'uuid' => Uuid::fromBytes($row->uuid)->toString(), + 'uuid' => Uuid::fromBytes(DbUtil::binaryResult($row->uuid))->toString(), ]; if ($row->host !== null) { $params['host'] = $row->host; @@ -59,7 +60,7 @@ class ObjectsTableService extends ObjectsTable /* if ($this->branchUuid) { $url = Url::fromPath('director/service/edit', [ - 'uuid' => Uuid::fromBytes($row->uuid)->toString(), + 'uuid' => Uuid::fromBytes(DbUtil::binaryResult($row->uuid))->toString(), 'host' => $row->host, ]); } else {