Backport refactoring from php-src
Merge branch 'PHP-5.6' of git.php.net:php-src into PHP-5.6
Reduce code duplication a bit
Merge branch 'PHP-5.6'

Conflicts:
	ext/mysqlnd/mysqlnd_ps_codec.c