Complete Mage p. 91 said:
THE POLYMORPH SUBSCHOOL
A feature introduced in Player's Handbook II and further developed
in this book is the polymorph subschool, which is defined
and explained below.
A spell of the polymorph subschool changes the target's
form from one shape to another. Unless stated otherwise in the
spell's description, the target of a polymorph spell takes on all
the statistics and special abilities of an average member of the
new form in place of its own except as follows:
• The target retains its own alignment (and personality, within
the limits of the new form's ability scores).
• The target retains its own hit points.
The target is treated has having its normal Hit Dice for purpose
of adjudicating effects based on HD, such as the sleep
spell, though it uses the new form's base attack bonus, base
save bonuses, and all other statistics derived from Hit Dice.
• The target retains the ability to understand the languages it
understands in its normal form. If the new form is normally
capable of speech, the target retains the ability to speak these
languages as well. It can write in the languages it understands,
but only if the new form is capable of writing in some
manner (even a primitive manner, such as drawing in the dirt
with a paw).
In all other ways, the target's normal game statistics are effectively
replaced by those of the new form. The target loses all of
the special abilities it has in its normal form, including its class
features (even if the new form would normally be able to use
these class features).
If the new form's size is different from the target's norma\
size, its new space must share as much of the original form's
space as possible, squeezing into the available space (PH 148)
if necessary. If insufficient space exists for the new form, the
spell fails.
Any gear worn or carried by the target melds into the new
form and becomes nonfunctional. When the target reverts to
its true form, any objects previously melded into the new form
reappear in the same location on its body they previously occupied
and are once again functional. Any new items worn in
the assumed form fall off and land at the target's feet.
The spellcaster can freely designate the new form's minor
physical qualities (such as hair color and skin color) within the
normal ranges for a creature of that kind. The new form's significant
physical qualities (such as height, weight, and gender)
are also under the spellcaster's control, but they must fall within
the norms for the new form's kind. The target of a polymorph
spell is effectively camouflaged as a creature of its new form,
and gains a +10 bonus on Disguise checks if it uses this ability
to create a disguise.
If the target of a polymorph spell is slain or rendered unconscious,
the spell ends. Any part of the body that is separated
from the whole remains polymorphed until the effect ends.
Incorporeal or gaseous creatures are immune to polymorph
spells, as are creatures of the plant type. A creature with the
shapechanger subtype (such as a lycanthrope or doppelganger)
can revert to its natural form as a standard action.
SPELLS THAT HAVE COME BEFORE
For the purpose of adjudicating effects that apply to polymorph
spells, any spell whose effect is based on either alter self or
polymorph should be considered to have the polymorph subschool.
However, note that the spells' existing rules text takes
priority over that of the subschool. Alter self, for instance, does
not change the target's ability scores (unlike normal for spells
of the polymorph subschool).