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

Jeff Segars jsegars at alumni.rice.edu
Tue Jan 11 21:18:48 CET 2011


On 12/9/10 4:31 AM, Krystian Szymukowicz wrote:
> W dniu 2010-12-07 19:26, Jeff Segars pisze:
>> On 11/2/10 5:37 AM, Krystian Szymukowicz wrote:
>>>
>>> Hi,
>>>
>>> this is a SVN patch request.
>>>
>>> Type: Bugfix, almost nobrainer
>>>
>>> BT reference: http://bugs.typo3.org/view.php?id=16216
>>>
>>> Branches: 4_4, trunk
>>>
>>>
>>> PROBLEM:
>>> The path for icon in taskcenter is created wtih:
>>> $icon = $GLOBALS['BACK_PATH'] . '../' . str_replace(PATH_site, '',
>>> $absIconPath);
>>>
>>> There are some edge situations when the PATH_site is equal to "/". In
>>> that case the backslash from icon path will be removed and such path of
>>> icon generated:
>>> http://example.com/typo3sysextsys_actionx-sys_action.png
>>>
>>> SOLUTION:
>>> Check if PATH_site is "/"
>>>
>>>
>>
>> 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?

Thanks,
jeff


More information about the TYPO3-team-core mailing list