[TYPO3-core] RFC: function cmpIPv4 - PHP 5.1.12 warning with wrong usage of array index
Martin Kutschker
Martin.Kutschker at n0spam-blackbox.net
Fri Jun 30 15:15:05 CEST 2006
Franz Holzinger schrieb:
> Hello Martin,
>
>
>>Franz Holzinger schrieb:
>>
>>
>>
>>>Description:
>>>
>>>The following line causes a lot of the same error message in PHP 5.1.12.
>>>You will get this on the screen with phpMyAdmin if you have turned on
>>>the display of error messages in php.ini and the install tool.
>>>
>>>functions cmpIPv4 and cmpIPv6
>>>
>>>list($test,$mask) = explode('/',$test);
>>>
>>>
>>
>>So can avoid all the changes from $test to $testArray (testef with E_ALL).
>>
>>$test = explode('/',$test);
>>$mask = (isset($test[1])) ? $test[1] : '';
>>$test = $test[0];
>>
>
> This works fine without any warning message now. See new patch.
+1 from me ;-)
>>But it's going to be a PITA if we try to avoid *notices*. If you notices
>>such stuff how about all the unitinitalited-variables warnings which must
>>be all over the place.
>
> I do not receive other warning messages link unitialized variables.
Not? I don't run with "notices" enabled (the above is a notice, not
warning). Knowing the code I'm surprised there are no warnings...
> However I receive the foreach wrong argument warnings if it happens.
> But it is helpful to correct this because warning messages can help to
> find some real bugs. Developers should turn the display of warning
> messages on. Many error reporters will copy such messages into the
> bugtracker. Therefore the code should not produce them.
I agree on this principle. But I do know that TYPO3 wasn't written with
that in mind. So I reckoned that is hard work to remove all warnings from
the Core.
Masi
More information about the TYPO3-team-core
mailing list