[TYPO3-core] RFC: Feature #2883 / t3lib_div::trimExplode

Dmitry Dulepov [typo3] dmitry at typo3.org
Mon Sep 10 10:49:40 CEST 2007


Hi!

We have got a problem :(

Martin Kutschker wrote:
>     function trimExplodeMASI($delim, $string, $onlyNonEmptyValues=0) {
>         $array = explode($delim, $string);
>         if ($onlyNonEmptyValues) {
>             foreach($array as $index => &$value) {
>                 $value = trim($value);
> 		  if ($value == '') {
> 			unset($array[$index]);

Line "$value = trim($value);" does not change $array[$index] since 
"unset" was called. See image #1 and values of $value and $array[$index] 
at bottom of the image. At least it is so on PHP 5.2.1. Array always 
stays as is after the first unset line. I found it because EM shows 
garbage while trying to update tables (see image #2). Should be changed 
to explicit value setting if there was unset I think.

-- 
Dmitry Dulepov
TYPO3 freelancer / TYPO3 core team member
Web: http://typo3bloke.net/
Skype: callto:liels_bugs
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trimExplode-1.png
Type: image/png
Size: 19092 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20070910/6c3ebc12/attachment-0002.png 
-------------- next part --------------
A non-text attachment was scrubbed...
Name: trimExplode-2.png
Type: image/png
Size: 2277 bytes
Desc: not available
Url : http://lists.netfielders.de/pipermail/typo3-team-core/attachments/20070910/6c3ebc12/attachment-0003.png 


More information about the TYPO3-team-core mailing list