After installing dev-php/mod_php, version 4.3.1, I saw that all the files in /usr/lib/php have the go+w permission.
confirmed this, /usr/lib/php looks like this; drwxr-xr-x 2 root root 72 Apr 9 15:53 Archive drwxr-xr-x 2 root root 80 Apr 9 15:53 Console drwxr-xr-x 2 root root 432 Apr 9 15:53 DB -rw-rw-rw- 1 root root 27414 Apr 9 15:53 DB.php -rw-rw-rw- 1 root root 7719 Apr 9 15:53 HTTP.php drwxr-xr-x 2 root root 160 Apr 9 15:53 Mail -rw-rw-rw- 1 root root 7279 Apr 9 15:53 Mail.php drwxr-xr-x 2 root root 104 Apr 9 15:53 Net drwxr-xr-x 2 root root 80 Apr 9 15:53 OS drwxr-xr-x 4 root root 416 Apr 9 15:53 PEAR -rw-rw-rw- 1 root root 28562 May 9 21:34 PEAR.php -rw-rw-rw- 1 root root 14780 Apr 9 15:53 System.php drwxr-xr-x 3 root root 128 Apr 9 15:53 XML drwxr-xr-x 3 root root 72 Feb 20 20:59 data drwxr-xr-x 4 root root 104 Feb 20 20:59 docs drwxr-xr-x 4 root root 104 Feb 20 20:59 tests
I had previously fixed this in mod_php-4.3.1-r2.ebuild. I've added the patch to mod_php-4.3.1.ebuild and mod_php-4.3.1-r1.ebuild now.