Add check against PHP's 0 == 'anystring' problem
authorRaphaël Barrois <raphael.barrois@polytechnique.org>
Wed, 28 Apr 2010 15:17:46 +0000 (17:17 +0200)
committerRaphaël Barrois <raphael.barrois@polytechnique.org>
Wed, 28 Apr 2010 15:17:46 +0000 (17:17 +0200)
We might have to check lots of code to avoid this...

Signed-off-by: Raphaël Barrois <raphael.barrois@polytechnique.org>
classes/userfilter.php

index e6756c4..689b5ce 100644 (file)
@@ -2077,7 +2077,7 @@ class UserFilter extends PlFilter
     const GRADE_MST = 'M%';
     static public function isGrade($grade)
     {
-        return $grade == self::GRADE_ING || $grade == self::GRADE_PHD || $grade == self::GRADE_MST;
+        return ($grade !== 0) && ($grade == self::GRADE_ING || $grade == self::GRADE_PHD || $grade == self::GRADE_MST);
     }
 
     static public function assertGrade($grade)