Thanks for that insight. I assumed WP used MySQLi because of the $wpdb->prepare() statement, but as it seems it uses mysql_real_escape_string on all the parameters (among some other calls). Now I should reconsider some of my code designs.
Hi!
I just had a similar problem. The added priority number solved it for me. So instead of using:
remove_filter("comment_text", "wpautop");
The solution was:
remove_filter("comment_text", "wpautop", 30);
Maybe this helps someone. Thanks.