Fixed PHP-1149: Fix database and collection name validation.

Yes, fixed.