[Phpmyadmin-devel] (PMA_SQP_typeCheck) operator "===" and PHP 3
Marc Delisle
DelislMa at CollegeSherbrooke.qc.ca
Thu Feb 6 03:49:07 CET 2003
Rabus wrote:
> -----Original Message-----
> From: Marc Delisle [mailto:DelislMa at CollegeSherbrooke.qc.ca]
>
>>gettype( ) works on variables, but the case we have is:
>>if(strpos($whatWeWant, $typeSeperator) === FALSE) {
>>
>>I don't know if it works on expressions and constants.
>>
>>Anyway, looking at the code, we usually workaround this
>>strpos problem with the "append a blank" trick:
>>
>>if (strpos(' ' . $goto, 'tbl_properties') == 1) {
>>
>>Marc
>>
>
>
> Of course, it does. gettype() checks the type of the expression. A
> variable is also an expression, just like a function call, a mathmatic
> operation or whatever.
> I'm taking your example and using my workaround:
>
> if (strpos($whatWeWant, $typeSeperator) == FALSE &&
> gettype(strpos($whatWeWant, $typeSeperator)) == gettype(FALSE)) {
>
> Of course, we can make this a bit shorter:
>
> $tmp = strpos($whatWeWant, $typeSeperator);
> if (!$tmp && gettype($tmp) == 'boolean') {
>
> But our usual workaround for the strpos problem is this one:
>
> if (!strpos(' ' . $whatWeWant, $typeSeperator)) {
>
> Your code above appears incorrect to me because we want to have the case
> that the needle string does not appear in the haystack string, don't we?
> So 1 is wrong, it has to be 0 or FALSE (doesn't matter since 0 == FALSE
> :o) ).
>
> Alexander M. Turek
> <alex at bugfixes.info>
Ok Alexander. I have merged this, and usually we should use \xff
instead of a blank because chances are lower that we find a real \xff:
if(!strpos("\xff" . $whatWeWant, $typeSeperator)) {
Marc
More information about the Developers
mailing list