Properly parse Plural-Forms header of PO/MO files (2.6)

So this follows #5347, this time targeting the 2.6 branch, and hopefully compatible with PHP 5.2. I hope it’s fine even if it includes a few other commits not from me.
It seems like your stack is backwards. Wouldn't you `array_unshift()` and `array_shift()` with a stack? This looks like a queue that is being referred to as a stack. I think if you used unshift, you would be able to avoid the `end()` calls as you could use `$stack[0]` instead.