port changes from PHP 5.5.10