Simplexml fix + testcase for another bug.

Both commits have testcases. Only one of them has a supplied fix.

There has been a PR in the past to fix the other issue, however both me and Sarah weren't too happy on how it was implemented. Here is the original PR:
https://github.com/facebook/hiphop-php/commit/d35d81360eb0db5abbd5ad601fde94255e30fbd3

See the actual commit messages for more information.