Fix uncaught error "Argument #1 ($id) must be of type int, null given" when userOwner of userModification is null #15914
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
When userOwner and userModification are not set that time search by id is throwing error.
php.CRITICAL: Uncaught Error: Pimcore\Model\User\AbstractUser::getById(): Argument #1 ($id) must be of type int, null given, called in {project_root}/var/cache/acceptance/twig/ac/ac4a382cb38374880f7892b33abdbe63.php on line 174 {"exception":"[object] (TypeError(code: 0): Pimcore\Model\User\AbstractUser::getById(): Argument #1 ($id) must be of type int, null given, called in {project_root}/var/cache/acceptance/twig/ac/ac4a382cb38374880f7892b33abdbe63.php on line 174 at {project_root}/vendor/pimcore/pimcore/models/User/AbstractUser.php:41)"} []
File - templates/searchadmin/search/quicksearch/info_table.html.twig
Line number - 52 - 66
{% set owner = pimcore_user(element.getUserOwner()) %}
{% if owner is instanceof('\Pimcore\Model\User') %}
{{ 'owner'|trans([],'admin') }}
{{ owner.name }}
{% endif %}
There is no condition set.