Task #56025
closedReplace array_key_exists() with (isset($array[$key]) || array_key_exists())
0%
Description
Calling array_key_exists can be avoided most of the time by using isset().
isset() may however return FALSE for cases where there is in fact an existing key, but where the value is NULL. So we need to OR the isset() with the old array_key_exists to have a fallback in place for the cases where the array value is a NULL.
Updated by Gerrit Code Review almost 11 years ago
- Status changed from New 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/27644
Updated by Michiel Roos almost 11 years ago
Did you ever try to take a look at the Backend Log module?
This is the reason I went down this path. There are around a million method calls going on in there. About 931.908 on a good day. All to render 500 records of log with links to a history detail page if appropriate.
After applying this patch (and using a language construct over a more expensive PHP function), for the Backend Log, a reduction by 19.041 method calls is measured. That's 2%.
Memory usage is reduced by about 17% for the Backend Log request.
Updated by Markus Klein over 9 years ago
- Status changed from Under Review to Accepted
- Target version deleted (
6.2.0) - Complexity changed from no-brainer to medium
The current patch incarnation has been abandoned.
The solution must be to use isset() exclusively and array_key_exists() only if required. Needs a case-by-case inspection.
Updated by Susanne Moog over 5 years ago
- Status changed from Accepted to Closed
As there hasn't been any work done on this issue for 4 years, I'm closing this issue now. If anyone wants to pick it up again, please validate the performance improvements with newer PHP versions and vs. null coalescing - and open a new issue :)