Last modified: 2012-10-29 17:24:15 UTC

Wikimedia Bugzilla is closed!

Wikimedia migrated from Bugzilla to Phabricator. Bug reports are handled in Wikimedia Phabricator.
This static website is read-only and for historical purposes. It is not possible to log in and except for displaying bug reports and their history, links might be broken. See T14769, the corresponding Phabricator task for complete and up-to-date bug report information.
Bug 12769 - Preemptively fix possible weak type-checking errors
Preemptively fix possible weak type-checking errors
Status: NEW
Product: MediaWiki
Classification: Unclassified
General/Unknown (Other open bugs)
1.12.x
All All
: Low enhancement (vote)
: ---
Assigned To: Nobody - You can work on this!
:
Depends on:
Blocks: code_quality
  Show dependency treegraph
 
Reported: 2008-01-24 03:10 UTC by Aryeh Gregor (not reading bugmail, please e-mail directly)
Modified: 2012-10-29 17:24 UTC (History)
2 users (show)

See Also:
Web browser: ---
Mobile Platform: ---
Assignee Huggle Beta Tester: ---


Attachments

Description Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-01-24 03:10:18 UTC
$ grep "\([^\!=]==\|\!=\)\s*''" {includes,skins,languages,maintenance,math,../extensions}/{*,*/*,*/*/*,*/*/*/*}/*.php *.php 2> /dev/null | wc -l
481

That's a lot of == '' and != ''.  These should all be examined and fixed to either check strictly (if that's desired) or, I guess, drop the equality check, since that's more explicit.  Of course, this doesn't count all the cases where you say !$var and assume strong type checking, but there's not much hope for automatically detecting those.  Core looks a little better:

$ grep "\([^\!=]==\|\!=\)\s*''" {includes,skins,languages,maintenance,math}/{*,*/*,*/*/*}/*.php *.php 2> /dev/null | wc -l
27

I'll get on some of these, maybe, if I have the time.
Comment 1 Aryeh Gregor (not reading bugmail, please e-mail directly) 2008-01-24 03:41:11 UTC
Of course, my bash globbing was totally off . . .

$ grep "\([^\!=]==\|\!=\)\s*''" {includes,skins,languages,maintenance,math,../extensions}/{,*/,*/*/,*/*/*/}*.php *.php 2> /dev/null | wc -l
748
$ grep "\([^\!=]==\|\!=\)\s*''" {includes,skins,languages,maintenance,math}/{,*/,*/*/,*/*/*/}*.php *.php 2> /dev/null | wc -l
295

That looks less pleasant.
Comment 2 Siebrand Mazeland 2008-04-01 12:34:06 UTC
Score with 1.13alpha (r32654): 790/300 
Comment 3 Antoine "hashar" Musso (WMF) 2008-07-19 13:14:08 UTC
All on one line:
find . -name '*php' -exec grep -H "\([^\!=]==\|\!=\)\s*''" {} \;

Note You need to log in before you can comment on or make changes to this bug.


Navigation
Links