WordPress.org

Make WordPress Core

Changes between Initial Version and Version 1 of Ticket #24800, comment 5


Ignore:
Timestamp:
01/30/2014 08:10:04 PM (4 years ago)
Author:
jdgrimes
Comment:

Legend:

Unmodified
Added
Removed
Modified
  • Ticket #24800, comment 5

    initial v1  
    99> }}}
    1010
    11 This has broken some things. I noticed that some unit tests for one of my plugins were giving strange results. In one unit test for multisite, a blog would be created using `$this->factory->blog->create()`. Then stuff would fly apart in the next unit test, because for some reason the changes were being committed instead of rolled-back by MySQL. I eventually traced this down to the fact that the `CREATE TABLE` queries for new a new blog will have a leading newline. That is causing the `CREATE TABLE` query not to be converted to a `CREATE TEMPORARY TABLE` query. It worked before, because it was a simple `str_replace()`. Now it will ignore the query if there is leading whitespace.
     11This has broken some things. I noticed that some unit tests for one of my plugins were giving strange results. In one unit test for multisite, a blog would be created using `$this->factory->blog->create()`. Then stuff would fly apart in the next unit test, because for some reason the changes were being committed instead of rolled-back by MySQL. I eventually traced this down to the fact that the `CREATE TABLE` queries for new a new blog will have a leading newline. That is causing the `CREATE TABLE` query not to be converted to a `CREATE TEMPORARY TABLE` query. And a `CREATE TABLE` query will automatically cause a commit. It worked before, because it was a simple `str_replace()`. Now it will ignore the query if there is leading whitespace.
    1212
    1313I'll attach a patch with a possible fix.