ed-org-ua / nabuvote

E-Voting System for Public Control Council
17 stars 6 forks source link

Remove always undeclared variable checking #20

Closed elcreator closed 9 years ago

elcreator commented 9 years ago

https://github.com/imaginal/nabuvote/blob/master/system/functions.php#L558 https://github.com/imaginal/nabuvote/blob/master/system/functions.php#L575 https://github.com/imaginal/nabuvote/blob/master/system/functions.php#L591 $candidates is undefined here and can't be not empty

elcreator commented 9 years ago

maybe you mean global $candidates; (repeating globals in many functions is not good, maybe we need in candidates.php

function candidates() { 
global $candidates_test, $candidates;
/**
 * candidates switch
 */
return $candidates_test;
} 

instead).

Or simply require_once("candidates.php");

also is_array($candidates) is good in suggested function candidates or before foreach. Because if you not sure even that $candidates exists, you also not sure that foreach not fails with uncatchable exception

imaginal commented 9 years ago

a method of storing candidates will be changed soon.