Created attachment 437006 [details, diff] php-tidy-html5.patch The app-text/htmltidy is going to be gradually removed in favor of app-text/tidy-html5 (see bug #564884). There are a few things we're waiting on: 1) We need a stable version of app-text/tidy-html5. 2) There are some keywords (that we support) that were dropped in tidy-html5 relative to htmltidy. Once those issues are resolved, it seems pretty simple to port dev-lang/php to the new library. A sample patch against php:7.0 is provided.
I created a pull request at, https://github.com/php/php-src/pull/1940 that fixes the issue upstream (by supporting both).
This made it into 7.1.x, but probably won't be backported: https://github.com/php/php-src/blob/php-7.1.0beta1/NEWS The only problem with the quick hack I posted originally is that the test suite will fail.
This is done in the new v7.1.0. Since upstream probably won't backport it, I'm not going to bother unless there's a critical vulnerability.