Fixing issue #1104 and updating tests.

`while (($arg = array_shift($args)) !== null) {` is more explicit and compact.