r109263 MediaWiki - Code Review archive

Repository:MediaWiki
Revision:r109262‎ | r109263 | r109264 >
Date:00:32, 18 January 2012
Author:awjrichards
Status:ok
Tags:sopa 
Comment:
Fixing inversed logic for checking string lengths
Modified paths:
  • /trunk/extensions/CongressLookup/SpecialCongressLookup.php (modified) (history)

Diff [purge]

Index: trunk/extensions/CongressLookup/SpecialCongressLookup.php
@@ -115,6 +115,8 @@
116116 .sopaActionDiv {
117117 margin-bottom: 1em;
118118 }
 119+p.error {
 120+}
119121 </style>
120122 </head>
121123 <body>
@@ -345,12 +347,12 @@
346348 public function isValidZip( $zip ) {
347349 $zipPieces = explode( '-', $zip, 2 );
348350
349 - if ( strlen( $zipPieces[0] ) == 5 || !is_numeric( $zipPieces[0] )) {
 351+ if ( strlen( $zipPieces[0] ) != 5 || !is_numeric( $zipPieces[0] )) {
350352 return false;
351353 }
352354
353355 if ( isset( $zipPieces[1] )) {
354 - if ( strlen( $zipPieces[1] ) == 4 || !is_numeric( $zipPieces[1] )) {
 356+ if ( strlen( $zipPieces[1] ) != 4 || !is_numeric( $zipPieces[1] )) {
355357 return false;
356358 }
357359 }

Status & tagging log