Bug #16375
closedPerformance tunning : avoid low php-functions
0%
Description
Using foreach instead of while (list() = each())
Using strpos instead of strstr for conditions
(issue imported from #M6037)
Files
Updated by Oliver Klee over 17 years ago
Popy, are you sure this is the right patch? It seems more to be about sql_free_result and using COUNT.
Updated by Benni Mack over 17 years ago
I like the patch. Finally a first step in getting rid of all the PHP3-made code from ten years ago ;-).
Updated by Oliver Hader over 17 years ago
- $vval vs. $val
- $kAkey vs. $Akey
The "\\" and "//" in t3lib_div::validPathStr could possibly be put into to the preg_match.
Thanks Popy for the patch!
Updated by Oliver Klee over 17 years ago
function inList($list,$item) {
- return strstr(','.$list.',', ','.$item.',') ? true : false;
+ return strpos(' ,'.$list.',', ','.$item.',') ? true : false;
Is this correct? Usually, the result of strpos needs to be compared with false to test for the existence of one string in another.
Updated by Popy no-lastname-given over 17 years ago
No because i did add a space befire the first comma (added to $list) so if the found item is the first, strpos will return 1 (and not 0 which have to be comparated to false)
Updated by Popy no-lastname-given over 17 years ago
@ Oliver Hader : I did correct my typos and attach the file. It's first time you agree with me, that's a nice day ;)
Updated by Oliver Hader over 17 years ago
;-)
I have an additional issue for TYPO3 4.2 which will require PHP 5.2:
The foreach loops can be improved by factor 1.5-2 on using references, e.g.
foreach ($array as $key => <b>&</b>$value) { ... }
Updated by Oliver Hader over 17 years ago
I'm going to change the foreach reference thingy, test each of the changes again and then finally post it to the Core-List.
Updated by Oliver Hader over 17 years ago
I reviewed Popy's patch and additionally changed some things (e.g. with the foreach references). I left the function t3lib_div::trimExplode() untouched because there is already a RFC in the Core-List (see bug #15834).
Updated by Franz Holzinger over 17 years ago
see also 6193 which belongs to here
Updated by Oliver Hader almost 17 years ago
I'm going to modify the patch concerning to PHP5 changes in t3lib_div this weekend.
Updated by Oliver Hader almost 17 years ago
I've attached a new patch which now works again with current "Trunk" (TYPO3_4-2).
Updated by Oliver Hader almost 17 years ago
Committed to SVN TYPO3_4-2 (rev. 3216)