Ampersand inside HTML comment causes wp_insert_post to loop infinitely
|Reported by:||jpayette||Owned by:|
I'm encountering an issue with wp_insert_post where, when the post_content contains an HTML comment containing an ampersand (ie, "<!-- & -->"), wp_insert_post seems to be getting stuck in an infinite loop. As far as I can tell, it is endless escaping the & into & over and over.
I've attached a small script that reproduces this error; you need to replace the HTTP_HOST and the path to wp-load.php to reflect your own machine for it to run. I've reproduced this issue on two different machines, both running Ubuntu 12.04, one on Wordpress 3.3.1 and the other on Wordpress 3.3.2.
The most bizarre thing about this issue, to me, is if you move the contents of the includeFiles() function out of the function and into the main body of the script, the issue no longer occurs. Somehow, including wp-load.php from a function is causing the infinite loop.