Hi Claus,

yes… it is clear now and i got your intention :-)

thanks.

best,
Michael

Von: Claus Due <notifications@github.com<mailto:notifications@github.com>>
Antworten an: FluidTYPO3/vhs <reply@reply.github.com<mailto:reply@reply.github.com>>
Datum: Dienstag, 3. Juni 2014 17:13
An: FluidTYPO3/vhs <vhs@noreply.github.com<mailto:vhs@noreply.github.com>>
Cc: Michael Staatz <michael.staatz@gdata.de<mailto:michael.staatz@gdata.de>>
Betreff: Re: [vhs] [BUGFIX] The function "strpos" may return Boolean FALSE (#597)


In Classes/ViewHelpers/Page/AbsoluteUrlViewHelper.php:

> @@ -37,7 +37,7 @@ class Tx_Vhs_ViewHelpers_Page_AbsoluteUrlViewHelper extends \TYPO3\CMS\Fluid\Cor
>        */
>       public function render() {
>               $url = \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_REQUEST_URL');
> -             if (0 === strpos($url, \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'))) {
> +             if (FALSE === strpos($url, \TYPO3\CMS\Core\Utility\GeneralUtility::getIndpEnv('TYPO3_SITE_URL'))) {


Hi Michael,

There is a difference between these two statements:

"I wish to check if the site URL is already the very first part of the string" (1)

And:

"I wish to check if the site URL exists anywhere in the string" (2)

Only (1) describes our intention and the only way to check if the site URL is not already the first part is to check 0 !== strpos.

This url, for example, will when decoded which it is in the ENV, make your code behave incorrectly:


Your code would make the condition TRUE and would not prefix the site domain. My suggested change to that expression makes sure the domain is prefixed even if it is also given as another argument's value.

Clear now?


—
Reply to this email directly or view it on GitHub<https://github.com/FluidTYPO3/vhs/pull/597/files#r13339657>.

____________
Virus checked by G Data MailSecurity
Version: AVA 24.2470 dated 04.06.2014
Virus news: www.antiviruslab.com