REST API: Fix PHP 5.2 compatibility.

See 7b51ed185d701effa17cac3a6d08528b7ad51065