Fatal error on export/clone/create child theme
-
Hello
I am using Poe theme by Anders Noren in a website that’s part of a multisite install.
When I try to export / clone / create child theme I get a fatal error – uncaught error: Call to undefined method WP_Error::addEmptyDir() …. public_html/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php on line 95.
I succeed only in creating a style variation and an empty theme, so the plugin is working somehow – should this exclude incompatibility issues?
Any suggestion?
Thanks!
EO
-
Hey there @elenaocone – there have been some issues reported with themes missing an
index.phpfile, only on multisite installs. Please see here for more information.As a temporary workaround and test, could you please try adding an empty
index.phpto the root of the Poe parent theme.Let me know if that solves it. If it does, this would only be a temporary fix, but I’ll let you know the next steps at that point. 🙂
Thanks!
Hello again @zoonini
I tried adding a index.php file in Poe’s root folder, but the error stays.
I tried activating TwentyTwentytwo in one other website of the multisite install but I’ve got the same error there as well.
Btw, WooCommerce is activated at site level, and is active in the Poe themed site and not in the TwentyTwentyTwo one, so I don’t know what to try next…
Any other suggestion?
Hi there,
Would you be able to share the version of WordPress and PHP that your site is running?
It appears the error results from
addEmptyDirbeing undefined on theziparchive. This method was added in PHP 5.2 and up.Thanks!
Hello
I updated Create Block Theme to the new version 1.7.0, updated the network, purged the cache but the error persists
Hi @elenaocone — unfortunately I’m unable to replicate this fatal. Here’s the steps I tried:
- Created a new multisite instance, WP 6.1.1, PHP 7.4.1
- Installed and activated Poe, Create Block Theme (1.7.0)
- Verified Export, Clone, Create Child Theme
Here’s what I would recommend:
- Export the theme using the Site Editor’s controls: https://cloudup.com/cT-Db6QxXK4/f
- Upload the theme to a non-multisite / non-production instance of WP
- Install and activate the plugin, and try exporting
Hello @jffng
I tried exporting via the Site Editor, but I ‘got a “Zip Export not supported” response.
Unfortunately I don’t have access to a non-multisite install, I tried creating a new site on another multi install but I have got the same error, both with Poe and with TwentyTwentyThree, and “Zip export not supported” error as well.
If can be of any use, here’s the full error log:
Fatal error: Uncaught Error: Call to undefined method WP_Error::addFromString() in …/public_html/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php:73 Stack trace: #0 …/public_html/wp-content/plugins/create-block-theme/admin/class-create-block-theme-admin.php(254): Theme_Zip::copy_theme_to_zip(Object(WP_Error), NULL, NULL) #1 …/public_html/wp-content/plugins/create-block-theme/admin/class-create-block-theme-admin.php(417): Create_Block_Theme_Admin->export_theme(Array) #2 …/public_html/wp-includes/class-wp-hook.php(308): Create_Block_Theme_Admin->blockbase_save_theme(”) #3 …/public_html/wp-includes/class-wp-hook.php(332): WP_Hook->apply_filters(NULL, Array) #4 …/public_html/wp-includes/plugin.php(517): WP_Hook->do_action(Array) #5 …/public_html/wp-admin/admin.php(175): do_action(‘admin_init’) #6 …/public_html/wp-admin/themes.php(10): require_once(‘/home/holistud/…’) #7 {main} thrown in …/public_html/wp-content/plugins/create-block-theme/admin/create-theme/theme-zip.php on line 73
What else can we try now?
Hi @elenaocone –
Unfortunately I don’t have access to a non-multisite install
You can create a free test site here: https://instawp.com/
Let us know how it goes. It’s important to rule out the multisite install as a factor. Thanks. 🙂
Thanks for pointing me to Instawp, nice resource
I created a normal WP site and a multisite install, and in both cases both Create Block Theme plugin and the Editor export function perfectly.
So the problem must lie in my websites: I have tried deactivating ALL plugins except Create Block Theme, but the error persists
What’s your opinion?
We are anyway investigating further, and I will keep you posted.
@elenaocone Great, thanks for keeping folks posted here if you discover anything that might help explain the issue on this particular install.
I have created a fresh WordPress 6.1.1 – PHP 7.4 install with a new domain and no plugin.
I have installed and made some customization to TwentyTwentyThree, installed and activated Create Block Theme but got the same Fatal Error.
I submitted all our tests to my provider as well, and they suggest that the problem should emerge from the plugin configuration.
At the moment I have no solution but to wait for an update that might bring up a change.
Do you know of any work in progress?
@elenaocone The developers are aware of the issue, but as Jeff mentioned above, they have not yet been able to replicate it. Since it does not occur on every host, there must be a hosting configuration issue. May I ask who your host is?
Hello @zoonini
Updated to WordPress 6.2 and the problem persists. Our host is Namecheap, but do you know of any kind of hosting configuration detail that could prevent the plugin from working properly?
Apart from ModSecurity settings – that’s the first thing we tried, even disabling it completely, with no result.
Anyway, the line throwing the error is this:
// Add current file to archive
$zip->addFromString( $relative_path, $contents );Call to undefined method WP_Error::addFromString()
I think only the plugin devs know where the method should be defined and why it isn’t…
Hi @elenaocone – I spoke with a couple of the plugin’s developers and they suggest asking your host to confirm whether they the
libziplibrary installed within your server’s PHP configuration. This plugin won’t currently work without support for these specific two functions:addEmptyDir()andaddFromString(), which are part of that PHP extension.You could also install a PHP info plugin like this one to check that yourself.
If
libzipis not installed on your server, you could ask your host if they would be willing to activate it for you.Let me know how it goes!
The topic ‘Fatal error on export/clone/create child theme’ is closed to new replies.