User "Danwe" posted a comment on MediaWiki.r81676.

Full URL: http://www.mediawiki.org/wiki/Special:Code/MediaWiki/81676#c26200
Commit summary:

Minor fix and incremented version number

Comment:

having the 'empty' option as default is not a good idea, this is potentially 
breaking some stuff. Also after doing this (using unset() on the array), 
reorganizeArrayKeys() must be executed on the array or you might have errors in 
a couple of other functions (just had one in #arraysearcharray) because all 
functions will assume that there are no gaps within array key order!

Is there any good reason for having something like 'empty' or the opposite as 
an option? By default all values will end up in the array, also empty ones, if 
you use '#arrayunique' on it it will remove all empty entries as well as 
duplicates.
The design flaw lies within the arrayunique function/option where it is not 
possible to preserve a single empty item. This is bugging me ever since the 
first version of arrayextension although I never ran in an actual case where it 
would have blocked my work, if so I would have written another parser function 
or a third parameter for arrayunique allowing an option to alter that behavior. 
Trying to avoiding all this by adding more options to arraydefine which is too 
complex and buggy as it is doesn't seem like the best solution.

_______________________________________________
MediaWiki-CodeReview mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-codereview

Reply via email to