Fix for missing intermediate variables introduced by #101

This preserves the behavioral change introduced in #101, but adds intermediate
variables to avoid PHP "strict standards" errors.

Partially reverts 4e0157f2c7d2c00e294c9b28b0b71da712c44893