Description
Preconditions (*)
- Magento version 2.4.x
- Magento 2.4-develop
Steps to reproduce (*)
- Go to Admin -> Stores -> Configuration -> Catalog -> Catalog -> Search Engine Optimization
- Clear product and category url suffix values in admin and save
Run GraphQL query that requests product and/or category url suffix value
{
categoryList {
url_suffix
}
}
Expected result: Empty string (''
) is returned for url_suffix
value
Actual Result: ✖️ Query fails
✖️ with the following error in exception.log
:
2020-11-20 13:29:04] main.ERROR: Return value of Magento\CatalogUrlRewriteGraphQl\Model\Resolver\CategoryUrlSuffix::getCategoryUrlSuffix() must be of the type string, null returned {"exception":"[object] (GraphQL\\Error\\Error(code: 0): Return value of Magento\\CatalogUrlRewriteGraphQl\\Model\\Resolver\\CategoryUrlSuffix::getCategoryUrlSuffix() must be of the type string, null returned at /var/www/html/magento24/vendor/webonyx/graphql-php/src/Error/Error.php:174, TypeError(code: 0): Return value of Magento\\CatalogUrlRewriteGraphQl\\Model\\Resolver\\CategoryUrlSuffix::getCategoryUrlSuffix() must be of the type string, null returned at /var/www/html/magento24/app/code/Magento/CatalogUrlRewriteGraphQl/Model/Resolver/CategoryUrlSuffix.php:80)"} []
Additional Information
The problem is that the private functions getProductUrlSuffix
and getCategoryUrlSuffix
are declared with string
as the return type, but when values are cleared in admin config, null
gets stored in the core_config_data
table. The value being returned by ScopeConfigInterface->getValue
should be checked for null and changed to empty string instead.
I will create PR to fix this.
Please provide Severity assessment for the Issue as Reporter. This information will help during Confirmation and Issue triage processes.
- Severity: S0 - Affects critical data or functionality and leaves users without workaround.
- Severity: S1 - Affects critical data or functionality and forces users to employ a workaround.
- Severity: S2 - Affects non-critical data or functionality and forces users to employ a workaround.
- Severity: S3 - Affects non-critical data or functionality and does not force users to employ a workaround.
- Severity: S4 - Affects aesthetics, professional look and feel, “quality” or “usability”.
Metadata
Metadata
Assignees
Labels
Type
Projects
Status