When trying a batch download (through REDCap reports), there will be an error in following scenario:
Many records in batch (n>400)
Batch job has been tried before and failed with invalid download (.zip archive cannot be uncompressed)
Full Error Message:
Fatal error: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in \www\redcap\modules\pdf_injector_v2.2.0\batch.php:123 Stack trace: #0 \www\redcap\modules\pdf_injector_v2.2.0\batch.php(123): fwrite(false, '%PDF-1.6\n%\xE2\xE3\xCF\xD3\n...') #1 \www\redcap\redcap_v12.4.26\ExternalModules\index.php(126): require('C:\\laragon\\www\\...') #2 {main} thrown in \www\redcap\modules\pdf_injector_v2.2.0\batch.php on line 123
REDCap crashed due to an unexpected PHP fatal error!
Error message: Uncaught TypeError: fwrite(): Argument #1 ($stream) must be of type resource, bool given in modules\pdf_injector_v2.2.0\batch.php:123 Stack trace: #0 modules\pdf_injector_v2.2.0\batch.php(123): fwrite(false, '%PDF-1.6\n%\xE2\xE3\xCF\xD3\n...') #1 redcap_v12.4.26\ExternalModules\index.php(126): require('C:\\laragon\\www\\...') #2 {main} thrown
File: modules\pdf_injector_v2.2.0\batch.php
Line: 123
this issue is a secondary consequence from insufficient memory_limit during zip creation. File deletion will not be processed which leads to blocking fopen which returns false to fwrite.
Possible fix:
remove /tmp on batch start
catch memory_limit exception and delete files + notify user?
When trying a batch download (through REDCap reports), there will be an error in following scenario:
Full Error Message: