Fixed day_of_week function as it could sometimes return negative values internally.
Merge branch 'day-of-week-issues' into PHP-5.5
Merge branch 'PHP-5.5' into PHP-5.6