Closed renky closed 7 years ago
ok sorry - after shortly thinking about it: This Function protected function createJsonBody(array $data) doesn't make sense like it is... In the function it is checked if it is an array or not - but the header already forces the input to be an array... but on the other hand when writing a file, it is usually a string - is there a case where this data is really an array? And how should it be? Is the solution only to remove the "array" from the createJsonBody-Definition? So this solves my problem now, but what did the creator want, when he wrote the function?
You are right, it shouldn't have a type-hint of array on the createJsonBody or on the data input for post, put or patch methods (just over aggressive type-hinting by me).
I think we could just remove the type-hints and that should solve it.
When using the file write method there happens a PHP Catchable fatal error. Has anybody already used file write and read successfully?
$lxd->containers->files->write($containernamename,'/etc/network/interfaces', 'test'); leads to: PHP Catchable fatal error: Argument 1 passed to Opensaucesystems\Lxd\Endpoint\AbstructEndpoint::createJsonBody() must be of the type arra y, string given, called in /..../vendor/opensaucesystems/lxd/src/Endpoint/AbstructEndpoint.php on line 51 and defined in /..../vendor/opensaucesystems/lxd/src/Endpoint/AbstructEndpoint.php on line 121