[TYPO3-core] RFC #15644: Replace magic numbers for shortcut_mode with class constants

Ernesto Baschny [cron IT] ernst at cron-it.de
Mon Sep 6 22:57:31 CEST 2010


Steffen Kamper schrieb am 06.09.2010 20:07:
> Hi,
> 
> Ernesto Baschny [cron IT] schrieb:
>> Please don't change the "==" with "===" in this patch, as this would
>> mean a change of functionality and not only an introduction of
>> constants. That should be a separate RFC, if someone wants to try that.
>>
>> e.g.
>>
>>     if ($row['shortcut_mode'] == 0)
>>
>> should be the same as
>>
>>     if ( (int)$row['shortcut_mode'] === 0 )
>>
> 
> 
> i disagree :) shortcut_mode is int in DB, so no need for conversion.

If you do an "sql_fetch_assoc()" (like it is done here to get $row), you
get an array full of strings, regardless of the field type in the DB. So
a strict check like:

  $row['shortcut_mode'] === 0

will fail.

Cheers,
Ernesto


More information about the TYPO3-team-core mailing list