During install of a profile that bundles Flag, we're running into this error:
PDOException: SQLSTATE[42S02]: Base table or view not found: 1146 Table 'flag' doesn't exist: SELECT e.* FROM {flag} e; Array ( ) in flag_entity_info().
This looks like another case of the well-known, though dreaded, #1311820: Don't do a registry_update() before installing a module.
Core has so far not fixed this critical issue; so far, modules have had to work around the issue by adding checks around their implementations of hook_entity_info().
| Comment | File | Size | Author |
|---|---|---|---|
| #1 | flag-fix_entity_info_failure_during_install-2492409-1-7.x-3.x-dev.patch | 979 bytes | guypaddock |
Comments
Comment #1
guypaddock commentedAttached is a patch for this issue. This is a pretty standard pattern for avoiding this issue unless core ever corrects it (unlikely).
Comment #2
joachim commentedThere's already an issue for this problem: #1870300: Upgrade from Flag 2.x to Flag 3.x can fail if other update hooks clear cache. Though over there, it's only about upgrade from Flag 2.x. I'm surprised this happens on install too, as our tests are working!
Thanks for finding that core bug! This bug has been a niggle for ages, as I was sure Flag's code was doing everything by the book. I was hoping there was some way to fix this without totally sidestepping the defining of our bundles, as it feels really ugly. However, the core bug seems to indicate that we do need to do this.
The patch over at #1870300: Upgrade from Flag 2.x to Flag 3.x can fail if other update hooks clear cache does a db_table_exists() rather than a try-catch, which seems slightly cleaner.