[TYPO3-core] RFC #15002: Enhancement of t3lib_div::isFirstPartOfStr

Steffen Kamper info at sk-typo3.de
Tue Jul 6 10:31:39 CEST 2010


Hi,

Jigal van Hemert schrieb:
> Michiel Roos [netcreators] wrote:
>> On 7/5/10 11:35 PM, Steffen Kamper wrote:
>>> * early return when one parameter is not a string
>> The docs say: If needle is not a string, it is converted to an integer
>> and applied as the ordinal value of a character.
>>
>> http://de.php.net/strpos
>>
>> So . . . it's best to let strpos decide en and not bail out if the
>> parameter is not a string.
> 
> The TYPO3 API says both parameters must be a string, so it should not 
> accept an integer IMO.
> 

yes, that's what i think too. I would prefer type hinting, but it's not 
possible with string (why?).

think of these calls:
isFirstPartOfStr(NULL, 'a')
isFirstPartOfStr('string', NULL)
isFirstPartOfStr(array(a,b),'xyz')
etc

vg Steffen


More information about the TYPO3-team-core mailing list