function maybe_create_table() declared in two files
|Reported by:||mastermind||Owned by:|
The function maybe_create_table() is a nice helper for plugins that need to create a database table. As it is not available by default, one has to include the file which contains this function. So far so good.
However, maybe_create_table() is declared in /wp-admin/install-helper.php as well as in /wp-admin/includes/upgrade.php.
If, as a matter of coincidence, both of the above files are loaded, then this will of course throw a "Fatal error: Cannot redeclare maybe_create_table() in /var/www/htdocs/elnl.zirona.de/wp-admin/includes/upgrade.php on line 735"
This is not only theoretical, but I actually encountered this in the following situation:
A plugin of mine uses a function activate_plugin(), called via register_activation_hook(__FILE__, 'activate_plugin');. That function loads /wp-admin/install-helper.php to use the function maybe_create_table(). When I tried to import content to the blog (Manage -> Import -> WordPress), the page would die with the Fatal error.
The solution was to temporarily deactivate the table creating routine from the activation function.
Change History (8)
- Milestone changed from 2.7 to 2.6.1
- Resolution fixed deleted
- Status changed from closed to reopened