## The problem
Calling EnvelopeApi\getDocument in the DocuSign eSign PHP client (docusign/esign-client) crashed with this fatal error. In ObjectSerializer.php line 285 the code called $data->read(200) on the response, but getDocument returns the file contents as a plain string, not a stream object. This hit any code path that downloads envelope documents via the SDK on versions before 5.3.0. Reporter confirmed the failure and provided the workaround of guarding with is_string().
## What fixed it
This was a confirmed SDK bug (DCM-4285), fixed in the 5.3.0 release. Upgrade with composer require docusign/esign-client:^5.3.0 (or newer). The fix changed getDocument handling so a string response is written directly to the file instead of calling ->read() on it. If you cannot upgrade, patch ObjectSerializer.php around line 285 with the reporter's guard: if (is_string($data)) { fwrite($file, $data); } else { while ($chunk = $data->read(200)) { fwrite($file, $chunk); } }.