Closed mtariqsajid closed 2 years ago
Yeah I just got caught by this breaking change too. You can see the change in the PR on ObjectSerializer.
You need to manually write the data to disk:
$filename = \tempnam(\sys_get_temp_dir(), 'docusign');
$file = \fopen($filename, 'wb');
// Need to rewind to the start, because docusign leaves the filepointer at the end
$document->rewind();
while (false === $document->eof()) {
// Write the file in chunks to avoid memory issues
$chunk = $document->fread(512);
\fwrite($file, $chunk);
}
\fclose($file);
@ndench could you clarify the reason for this modification?
As I can see it is not comfortable to receive file from DS now....
@Eugentis this modification is because the DocuSign client now saves the document in php://memory
instead of writing it to disk. The code I posted above is almost exactly the same as the DocuSign client used to do in order to write the file to disk, as you can see in the PR that made the change.
The $document
is the \splFileObject
returned by DocuSign, it used to point to a file on disk, but now it points to php://memory
. So we just read thy bytes from the file object, and write them to disk.
on 6.4 version the file was save on the php://temp
but on 6.5 version it is saving on the php://memory
how to change it to php://temp