Fixed bug #10175: Duplicated values in localconf.php
authorChristian Kuhn <lolli@schwarzbu.ch>
Fri, 26 Jun 2009 18:22:01 +0000 (18:22 +0000)
committerChristian Kuhn <lolli@schwarzbu.ch>
Fri, 26 Jun 2009 18:22:01 +0000 (18:22 +0000)
git-svn-id: https://svn.typo3.org/TYPO3v4/Core/trunk@5640 709f56b5-9817-0410-a4d7-c38de5d9e867

ChangeLog
t3lib/class.t3lib_install.php

index d875638..87c8a91 100755 (executable)
--- a/ChangeLog
+++ b/ChangeLog
@@ -4,6 +4,7 @@
 
 2009-06-26  Christian Kuhn  <lolli@schwarzbu.ch>
 
+       * Fixed bug #10175: Duplicated values in localconf.php
        * Added feature #8601: Hook for debug_typo3PrintError
        * Added feature #11229: stdwrap to override image of imageLinkWrap (thanks to Georg Ringer)
 
index cbf3b04..f3313fe 100644 (file)
@@ -140,6 +140,9 @@ class t3lib_install {
                $tokenSet = ($this->localconf_editPointToken && !$inArray);             // Flag is set if the token should be set but is not yet...
                $stopAtToken = ($this->localconf_editPointToken && $inArray);
                $comment = ' Modified or inserted by '.$this->updateIdentity.'.';
+               $replace = array('["', '"]');
+               $search = array('[\'', '\']');
+               $varDoubleQuotes = str_replace($search, $replace, $variable);
 
                        // Search for variable name:
                if (!$this->localconf_addLinesOnly && !$tokenSet)       {
@@ -156,7 +159,21 @@ class t3lib_install {
                                                $found = 1;
                                                break;
                                        }
-                               }
+                               } elseif (!strcmp(substr($v2, 0, strlen($varDoubleQuotes . ' ')), $varDoubleQuotes . ' ')) {
+                                               // Due to a bug in the update wizard (fixed in TYPO3 4.1.7) it is possible
+                                               // that $TYPO3_CONF_VARS['SYS']['compat_version'] was enclosed by "" (double
+                                               // quotes) instead of the expected '' (single quotes) when is was written to
+                                               // localconf.php. The following code was added to make sure that values with
+                                               // double quotes are updated, too.
+                                       $mainparts = explode($varDoubleQuotes, $v, 2);
+                                       if (count($mainparts) == 2) { // should ALWAYS be....
+                                               $subparts = explode('//', $mainparts[1], 2);
+                                               $line_array[$k] = $mainparts[0] . $variable . " = '" . $this->slashValueForSingleDashes($value) . "';   " . ('//' . $comment . str_replace($comment, '', $subparts[1]));
+                                               $this->touchedLine = count($line_array) - $k - 1;
+                                               $found = 1;
+                                               break;
+                                       }
+                               }
                        }
                        $line_array = array_reverse($line_array);
                }