Preliminary implementation of CodeIgniter's issue/PR 3194 and 3198.