Bug #91382
closedAjax Widgets with QueryResult Object as Argument throw an Error since 9.5.17
100%
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
Updated by Oliver Hader over 4 years ago
- Status changed from New to Needs Feedback
Can you please post a stack trace and if possible a dump of the objects to be JSON encoded as well - probably before the mentioned exception is thrown in https://github.com/TYPO3/TYPO3.CMS/commit/e4fb92a85bed8067d45d2c25c4b559642f206248#diff-680bd81bb107cde8de9cacd799385680R133
Thx
Updated by Jonas Götze over 4 years ago
- File var_dump.html var_dump.html added
- File composer.json composer.json added
- File typo3_52c8fd3ac4.log typo3_52c8fd3ac4.log added
- Priority changed from Should have to Must have
- Target version deleted (
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.
Updated by Jonas Götze over 4 years ago
- Priority changed from Must have to Should have
- Target version set to 9.5.18 & 10.4.3
sorry - these changes were not intended.
Updated by Oliver Hader over 4 years ago
- Status changed from Needs Feedback to Accepted
Okay, so we have
TYPO3\CMS\Extbase\Persistence\Generic\QueryResult
havingGeorgRinger\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.
Updated by Gerrit Code Review over 4 years ago
- Status changed from Accepted to Under Review
Patch set 1 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64501
Updated by Gerrit Code Review over 4 years ago
Patch set 2 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64501
Updated by Gerrit Code Review over 4 years ago
Patch set 3 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64501
Updated by Gerrit Code Review over 4 years ago
Patch set 1 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64503
Updated by Gerrit Code Review over 4 years ago
Patch set 4 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64501
Updated by Oliver Hader over 4 years ago
- Related to Bug #91418: UnknownClassException with Fluid autocomplete widget added
Updated by Gerrit Code Review over 4 years ago
Patch set 5 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64501
Updated by Gerrit Code Review over 4 years ago
Patch set 2 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64503
Updated by Gerrit Code Review over 4 years ago
Patch set 6 for branch master of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64501
Updated by Gerrit Code Review over 4 years ago
Patch set 3 for branch 9.5 of project Packages/TYPO3.CMS has been pushed to the review server.
It is available at https://review.typo3.org/c/Packages/TYPO3.CMS/+/64503
Updated by Oliver Hader over 4 years ago
- Status changed from Under Review to Resolved
- % Done changed from 0 to 100
Applied in changeset 18e3f4f7db2c2453579082c84c95ee8b2105e41b.