[TYPO3-core] RFC #16216 Bug: taskcenter - wrongly created path for icon (in certain conditions)

Krystian Szymukowicz t33k at prolabium.com
Tue Jan 11 22:54:02 CET 2011


W dniu 2011-01-11 21:18, Jeff Segars wrote:
>>>
>>> Hey Krystian,
>>> Thanks for your patch! I did a quick search through the core and found
>>> that similar str_replaces are done in about 10 other places. Also, it
>>> seems to me like there's a small issue that $absIconPath will still have
>>> its leading slash if PATH_site is / (since the str_replace is not done
>>> at all).
>>>
>>> Would the best solution be to just remove the first instance of
>>> PATH_site from $absIconPath and leave the rest of the string alone.
>>> Maybe something like....
>>>
>>> substr($absIconPath, strlen(PATH_site))
>>>
>>> What do you think?
>>>
>>
>> Yes you right with this leading slash. My bad - I saw icon in FF and and
>> did not check the generated code. So FF showed the icon despite not
>> correct path. Sorry for that oversight,
>>
>> So I created v3 of the path with your suggested code which works as
>> should and looks much cleaner.
>>
>>
>> As for other places in core where such str_replaces are done. I would be
>> glad to prepare pathes for that. Do you think it should be one patch for
>> all changed files or each such place with separate patch?
>>
>>
>> As for background. This problem with PATH_site = / touches all TYPO3
>> users of a a very big hoster in west and central europe. They claim to
>> have more than 1.000.000 accounts and did not want to do anything about
>> changing the root of a page to other value than "/".
>> So this is real problem and touches lot of people here.
>>
>>
>> PS: I though about this after creating the v3 paches. What if the
>> PATH_site have some special chars. Should not we use mb_substr and
>> mb_strlen instead of substr and strlen ?
>
> Hey Krystian,
> Sorry for the delay in getting back to you here. One patch for all
> changed files should be just fine.
>
> As for the special characters, this is where it gets a little trickier.
> Since mbstring is not required, I guess we would actually need to use
> t3lib_cs to determine the right method.
>
> As the English-only guy around here, I'm definitely not the right person
> to say what the best option here is. Does anyone else have any feedback?
>



hi Jeff

Thanks for finding time for this problem.


I've just dig to find similiar function in t3lib_div:

  public static function removePrefixPathFromList(array 
$fileArr,$prefixToRemove) {
      foreach ($fileArr as $k => &$absFileRef) {
        if (t3lib_div::isFirstPartOfStr($absFileRef, $prefixToRemove)) {
          $absFileRef = substr($absFileRef, strlen($prefixToRemove));
        } else {
          return 'ERROR: One or more of the files was NOT prefixed with 
the prefix-path!';
       }
      }
      return $fileArr;
   }



So core itself does not care about the problem of special chars in the path.

This means:
a) the problem do not exists
b) or this is just a bug in the core ;)

I will try to investigate that with some tests (in one week I hope).

-- 
grtz
Krystian Szymukowicz


More information about the TYPO3-team-core mailing list