Fix problem with new t3lib_div::trimExplode()
authorMartin Kutschker <martin.t.kutschker@blackbox.net>
Mon, 10 Sep 2007 13:09:26 +0000 (13:09 +0000)
committerMartin Kutschker <martin.t.kutschker@blackbox.net>
Mon, 10 Sep 2007 13:09:26 +0000 (13:09 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@2501 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_div.php

index 0337a95..0fc8974 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,12 @@
+
+2007-09-10  Martin Kutschker  <martin.t.kutschker@blackbox.net>
+
+       * Fix problem with new t3lib_div::trimExplode()
+
+2007-09-09  Martin Kutschker  <martin.t.kutschker@blackbox.net>
+
+       * Require PHP 5.1
+
 2007-09-05  Dmitry Dulepov  <dmitry@typo3.org>
 
        * Added Galician language to TYPO3
 2007-09-05  Dmitry Dulepov  <dmitry@typo3.org>
 
        * Added Galician language to TYPO3
index 9d5ffee..7a22896 100755 (executable)
@@ -1456,19 +1456,22 @@ class t3lib_div {
                        //  a) avoid check for $onlyNonEmptyValues in foreach loop
                        //  b) avoid unnecessary code when $onlyNonEmptyValues is not set
                if ($onlyNonEmptyValues) {
                        //  a) avoid check for $onlyNonEmptyValues in foreach loop
                        //  b) avoid unnecessary code when $onlyNonEmptyValues is not set
                if ($onlyNonEmptyValues) {
-                       foreach($array as $index => &$value) {
+                       $new_array = array();
+                       foreach($array as $index => $value) {
                                $value = trim($value);
                                $value = trim($value);
-                               if ($value == '') {
-                                       unset($array[$index]);
+                               if ($value != '') {
+                                       $new_array[] = $value;
                                }
                        }
                                }
                        }
-                       $array = array_merge($array);
+                       return $new_array;
                } else {
                        foreach($array as $key => &$value) {
                                $value = trim($value);
                        }
                } else {
                        foreach($array as $key => &$value) {
                                $value = trim($value);
                        }
+                       return $array;
                }
                }
-               return $array;
+                       // never reached
+               return array();
        }
 
        /**
        }
 
        /**