[TYPO3-core] RFC #9266: Bug: strcmp() with array as parameter in t3lib_div::linkThisScript() produces warnings with PHP 5.3

Benjamin Mack benni at typo3.org
Mon Sep 15 07:03:30 CEST 2008


Hey Niels,

Niels Pardon wrote:
> Hi Ingo,
> 
> Ingo Renner schrieb:
>> Niels Pardon wrote:
>>
>>> Solution:
>>> The strcmp() just checks whether the GET parameter has an empty string
>>> value. Let's do it with a simple !== '' and the warnings are gone.
>> !empty($var) is even more explicit and easier to understand
> 
> yes, that's true. But what if the $value = 0? Then empty($value) will be
> true and I'm not sure whether this intended.
Yes, but in your current one, you have a !== '' and then $value = 0 
wouldn't work either, right?

So, we could do a
============
if (!($var)) {
	unset(...);
} else {
	...
}
============
or even switch the if else to make it more readable.
if ($var) {
	...
} else {
	unset(...);
}

-- 
All the best,
benni.
-SDG-


More information about the TYPO3-team-core mailing list