Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

500 Internal Server Error on Save Changes #395

Closed
eirichmond opened this issue Jun 13, 2023 · 3 comments
Closed

500 Internal Server Error on Save Changes #395

eirichmond opened this issue Jun 13, 2023 · 3 comments
Labels
bug Something isn't working

Comments

@eirichmond
Copy link
Contributor

After editing theme templates, template parts, global styles and manual changes made in the theme.json file, I'm now getting an Internal Server Error when trying to 'Save Changes'

Screenshot 2023-06-13 at 18 18 09

Steps taken:

  1. Create Theme
  2. Makes edits in the FS UI
  3. Save Changes
  4. Make edits directly in the theme.json file
  5. Makes edits in the FS UI
  6. Save Change

For me this resulted an Internal Server Error.

@carolinan
Copy link

@pbking I wonder if this is the same error I was getting that I could not reproduce after resetting the database.

@eirichmond Have you enabled error logging and error notice displaying?
It is also possible that the manual changes to theme.json broke theme.json.

@eirichmond
Copy link
Contributor Author

eirichmond commented Jun 14, 2023

@carolinan error log shows call to undefined function in theme-media.php:140

[14-Jun-2023 05:32:40 UTC] PHP Fatal error: Uncaught Error: Call to undefined function download_url() in /Users/elliottrichmond/valet-sites/wooblocktheme/wp-content/plugins/create-block-theme/admin/create-theme/theme-media.php:140

I've noticed that where download_url() is used elsewhere, the following is called before the function is used:

if ( ! function_exists( 'download_url' ) ) {
    require_once ABSPATH . 'wp-admin/includes/file.php';
}

So I added the above to the main create-block-theme.php file just below the WPINC as follows:

if ( ! defined( 'WPINC' ) ) {
	die;
}

if ( ! function_exists( 'download_url' ) ) {
	require_once ABSPATH . 'wp-admin/includes/file.php';
}

Now, the previously generated theme gets removed/deleted completely from the /themes/ folder, which in turn results in a "theme not found" error on reload.

@vcanales
Copy link
Member

Closed via #398

@vcanales vcanales added the bug Something isn't working label Jun 23, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants