solspace / craft-freeform

Freeform for Craft: The most reliable form builder that's ready for wherever your project takes you.
https://docs.solspace.com/craft/freeform/v5/
Other
47 stars 61 forks source link

Broken Excel export #1604

Closed smnedelko closed 1 week ago

smnedelko commented 3 weeks ago

What happened?

When exporting submissions to Excel format, the next error occurs:

yii\base\ErrorException: ob_end_clean(): Failed to delete buffer. No buffer to delete in /app/vendor/solspace/craft-freeform/packages/plugin/src/Library/Export/ExportExcel.php:42

In the plugin/src/Library/Export/ExportExcel.php, the buffer is read using ob_get_clean function:

$writer->save('php://output');

$content = ob_get_clean();

ob_end_clean();

To fix it, the ob_get_clean should be replaced with the ob_get_contents function.

Errors and Stack Trace (if available)

yii\base\ErrorException: ob_end_clean(): Failed to delete buffer. No buffer to delete in /app/vendor/solspace/craft-freeform/packages/plugin/src/Library/Export/ExportExcel.php:42
Stack trace:
#0 /app/vendor/craftcms/cms/src/web/ErrorHandler.php(79): yii\base\ErrorHandler->handleError(8, 'ob_end_clean():...', '/app/vendor/sol...', 42)
#1 [internal function]: craft\web\ErrorHandler->handleError(8, 'ob_end_clean():...', '/app/vendor/sol...', 42)
#2 /app/vendor/solspace/craft-freeform/packages/plugin/src/Library/Export/ExportExcel.php(42): ob_end_clean()
#3 /app/vendor/solspace/craft-freeform/packages/plugin/src/Services/Pro/ExportProfilesService.php(271): Solspace\Freeform\Library\Export\ExportExcel->export()
#4 /app/vendor/solspace/craft-freeform/packages/plugin/src/controllers/export/QuickExportController.php(275): Solspace\Freeform\Services\Pro\ExportProfilesService->export(Object(Solspace\Freeform\Library\Export\ExportExcel), Object(Solspace\Freeform\Form\Types\Regular))
#5 [internal function]: Solspace\Freeform\controllers\export\QuickExportController->actionIndex()
#6 /app/vendor/yiisoft/yii2/base/InlineAction.php(57): call_user_func_array(Array, Array)
#7 /app/vendor/yiisoft/yii2/base/Controller.php(178): yii\base\InlineAction->runWithParams(Array)
#8 /app/vendor/yiisoft/yii2/base/Module.php(552): yii\base\Controller->runAction('', Array)
#9 /app/vendor/craftcms/cms/src/web/Application.php(350): yii\base\Module->runAction('freeform/export...', Array)
#10 /app/vendor/craftcms/cms/src/web/Application.php(649): craft\web\Application->runAction('freeform/export...', Array)
#11 /app/vendor/craftcms/cms/src/web/Application.php(312): craft\web\Application->_processActionRequest(Object(craft\web\Request))
#12 /app/vendor/yiisoft/yii2/base/Application.php(384): craft\web\Application->handleRequest(Object(craft\web\Request))
#13 /app/web/index.php(23): yii\base\Application->run()
#14 {main}

How can we reproduce this?

  1. Create a form with a couple of fields
  2. Go to the form submissions page
  3. Make a Quick export in Excel format

Freeform Edition

Pro

Freeform Version

5.6.7

Craft Version

5.4.9

When did this issue start?

Unsure

Previous Freeform Version

No response

kjmartens commented 1 week ago

Sorry for the delay and the trouble @smnedelko,

I can't duplicate this on my end, but I will have a developer check into it. 🙂

kjmartens commented 1 week ago

This should now be resolved in Freeform 5.7.2+ 🙂