Problem/Motivation
Function empty() checks the variable emptiness but not the value provided by the function result.
https://www.php.net/manual/en/function.empty.php
For example: #3080034: Remove array_filter from FieldInstanceSettings
the value passed into the trim() function can be unexpected and not safely handled compared to the empty() function.
Steps to reproduce
Find usage by using the following command.
grep -rEe "[^\w\.\>]empty\([^\$\)]" ./core/modules
grep -rEe "[^\w\.\>]empty\([^\$\)]" ./core/themes
Proposed resolution
Replace the expression with more appropriate checks or move the checked value into a variable before usage in the expression.
Nice to have: updated Drupal standard coding rule.
Remaining tasks
User interface changes
API changes
Data model changes
Release notes snippet
Issue fork drupal-3331945
Show commands
Start within a Git clone of the project using the version control instructions.
Or, if you do not have SSH keys set up on git.drupalcode.org:
Comments