Upstream commit [r6191]

"Start to remove PHP4-isms and get the code into the modern realm."