Think like a parser
... which means, sometimes, "totally stupid."
If you are a parser,
then you are in the business of trying to match-up some arbitrary bit of incoming text to some arbitrary grammar (which is a formal description of what "the language that you're supposed to be processing" is "supposed" to look like).
Now, every now and again, a syntax-error occurs, and when it does, "you fall down." But,
simpleton that you are, you can only report the line-number where you actually fell,
not where the original error occurred.
if (isset($_POST['user']) <=============================== LQQKY HERE!
$user = sanitizeString($_POST['user']);
$pass = sanitizeString($_POST['pass']);
My eagle-eyes notice the missing right-parentheses in that if
statement. This is probably where the chain-of-dominoes first began to fall, but it might not be the point at which the parser finally realized that it had landed in an unceremonious heap.
The moral of this story is thus: when any
language compiler (or interpreter) seems to be telling you that "an error has occurred
'here,'" what it is actually
saying is that the incontrovertible existence of an error has been discovered
'here.'" The actual point of failure is likely to be somewhere earlier,
as in this case. All that you know for certain is that "it is nearby."
PHP uses state-of-the-art parser technology, and pretty much everyone else does, too. Therefore, "don't blame PHP," and, really, don't blame yourself either.
They are all
Take hand, apply to forehead and repeat after me: "d'oh!!!"
Q: Why do computer programmers have flat foreheads?
Indentation is your best
friend. Use it, and use it consistently. If your editor has a "source code tidy" feature, use
it. Parsers do not care about white space, but your human eye does.