text nodes have no children.
proper SimpleXML toBoolean implementation

This fixes several things:
- root nodes without children have to return false.
- some_node->children() has to have children to be true.
- child nodes without children are always true!
don't include comments in simplexml child tree.

SimpleXML comments are a weird concept. They are visible in var_dumps as
comment nodes, but you cannot access them through children(), nor are
they present in for example count().

This change will prevent comments from being processed at all. It means
we move away from 5.4 validity by one step, but moves us closer by a
couple more steps due to all kinds of funky bugs this fixes.
children of simplexml nodes should inherit parent class

This already happens using simplexml_load_string, but it must also
happen when directly instantiating and specifying the XML through
constructor.
treat cdata nodes as text.

Perhaps this is not the best implementation. But at least it will allow
us to access cdata.
properly clone internal data from simplexml nodes

Most public attributes can be literally copied to the cloned node.
For attributes and children, they have to be regenerated.
fix SimpleXMLElement::addChild when passing a value

- When using specifying a value to addChild, SimpleXML does not display
it when the node is casted to a string, see the following test:
  hphp/test/slow/simple_xml/1641.php

- However, when you cast the return value of this call to string, it
does show a return value, see the following test:
  hphp/test/slow/simple_xml/1656.php (line 13)

- Additionally, this fixes "string nesting" because m_children needed to
be merged with the newly created string element due to the way strings
work in this extension.

Another test was added combining all these conditions.
move passing test from bad to good
a root node with attributes (and no children) is still true
fix offsetget when used on children()

Just like properties, when dealing with integer based lookups, we need
to iterate ourselves and pick the appropriate child.
fix simplexmlelement array cast

SimpleXML will implicitly convert string nodes to actual strings when
the parent node is casted to an array. It will only do this for top
level nodes. A test has been provided.