Friday, December 09, 2005

SNAFU of the day: All things are not created equal.



class blah {
public static function getJobs($valfirm_id, $alloc_status = self::ALLOC_PENDING, $alloc_status2 = self::ALLOC_ACCEPTED) {
global $db, $log;

$sql = "SELECT DISTINCT job_id
FROM tbl_valfirm_allocation_queue
WHERE valfirm_id = ? AND alloc_status = ?";

if ($alloc_status = self::ALLOC_PENDING) {
$sql .= " ORDER BY job_id DESC LIMIT 25"; // Pending
}

var_dump($alloc_status); //I produce int(1)

///extra stuff
}
}

var_dump(blah::ALLOC_REASSIGNED); //I produce int(4)
blah::getJobs(1, blah::ALLOC_REASSIGNED);



Puzzle: What's wrong with it?

All things are not created equal. I found this mistake of mine only after reading everything thrice; I rarely do this so didn't look for it straight away.

This particular bug has annoyed our admin girls for 3 days now, which means we get yelled at.

No comments: