Bug #91382
closed
Ajax Widgets with QueryResult Object as Argument throw an Error since 9.5.17
Added by Jonas Götze about 4 years ago.
Updated about 4 years ago.
Description
When using a fluid ajax widget (custom or from core, e.g. autocomplete widget) which stores its configuration in the session you get an Exception:
#1588178538 TYPO3\CMS\Fluid\Core\Widget\Exception
Widget configuration items either must be null, scalar, array or JSON serializable, got "TYPO3\CMS\Extbase\Persistence\Generic\QueryResult"
<input type="text" id="myautocomplete" name="myautocomplete" />
<f:widget.autocomplete objects="{news}" for="myautocomplete" searchProperty="title" />
This is because the security related change here https://github.com/TYPO3/TYPO3.CMS/commit/e4fb92a85bed8067d45d2c25c4b559642f206248 which does not accept such an object as it is not JsonSerializable.
Though I am unsure about where and how this should be fixed.
Files
- Description updated (diff)
- Status changed from New to Needs Feedback
- Target version set to 9.5.18 & 10.4.3
Thanks for looking into this.
I just created a new ddev with blank TYPO3 10 and ext:news (just as example - it is not related to news!).
Then edited the news list template and added the html from above. In the backend I created 3 simple news records, included Typoscript and added the list plugin to a site.
Please find the Stack trace from TYPO3 Log attached, also the output from f:debug of {news} and my composer.json.
- Priority changed from Must have to Should have
- Target version set to 9.5.18 & 10.4.3
sorry - these changes were not intended.
- Status changed from Needs Feedback to Accepted
Okay, so we have
TYPO3\CMS\Extbase\Persistence\Generic\QueryResult
having GeorgRinger\News\Domain\Model\News
items
- and this
QueryResult
object in the widget-context
Oops, an error occurred! Code: 202005141250595edad60f - {
"exception":"TYPO3\\CMS\\Fluid\\Core\\Widget\\Exception: Widget configuration items either must be null, scalar,
array or JSON serializable, got \"TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QueryResult\" in
/var/www/html/public/typo3/sysext/fluid/Classes/Core/Widget/WidgetContext.php:141
Stack trace:
#0 [internal function]: TYPO3\\CMS\\Fluid\\Core\\Widget\\WidgetContext->TYPO3\\CMS\\Fluid\\Core\\Widget\\{closure}(Object(TYPO3\\CMS\\Extbase\\Persistence\\Generic\\QueryResult))
#1 /var/www/html/public/typo3/sysext/fluid/Classes/Core/Widget/WidgetContext.php(148): array_filter(Array, Object(Closure))
#2 [internal function]: TYPO3\\CMS\\Fluid\\Core\\Widget\\WidgetContext->jsonSerialize()
As a consequence QueryResult
should be JsonSerializable
as well in order to fix this issue.
- Status changed from Accepted to Under Review
- Related to Bug #91418: UnknownClassException with Fluid autocomplete widget added
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
- Status changed from Resolved to Closed
Also available in: Atom
PDF