View Issue Details

IDProjectCategoryView StatusLast Update
0006975OXID eShop (all versions)4.07. Source code, Testpublic2019-05-03 14:15
ReporterSioweb Assigned To 
PrioritylowSeveritytweakReproducibilityalways
Status closedResolutionno change required 
Summary0006975: count() > 0 durch !empty() ersetzen
DescriptionHo!

i've seen that u fixed the php countable-warning with "is_array && count". Wouldn't it better to replace it with "!empty()" ?

This will be only one operation and empty produce less overhead than count() for larger arrays. Not that big deal but i think some hosts will be happy about some extra KiB memory :)

https://github.com/OXID-eSales/oxideshop_ce/blob/master/source/Application/Model/Basket.php#L1616

Also smarty can deal with isset() and empty(); to avoid |@count() // the @-error-prevention is also a little performance eater because it still call error function but as level zero.
TagsPerformance
ThemeFlow
BrowserNot defined
PHP VersionNot defined
Database VersionNot defined

Activities

QA

2019-05-03 14:15

administrator   ~0012879

Hello Sloweb,

you are right. That statement could also be made with "!empty". I would like to ask you to create a pull request if you want to improve the source code: https://github.com/OXID-eSales/oxideshop_ce/blob/master/CONTRIBUTING.md
It will be greatly appreciated.

I will close this entry as it isn't about a specific bug, but suggesting to improve the code quality in generally.

Kind regards
QA

-MK