close

Make WordPress Core

Opened 12 months ago

Closed 4 months ago

#63151 closed defect (bug) (fixed)

[E_WARNING] class-wp-customize-widgets.php:923

Reported by: artz91's profile ArtZ91 Owned by: audrasjb's profile audrasjb
Milestone: 6.9 Priority: normal
Severity: normal Version:
Component: Customize Keywords: has-patch has-unit-tests has-test-info dev-feedback
Focuses: Cc:

Description

Error occured at Customize page.

[E_WARNING]: Attempt to read property "title" on null in /wp-includes/class-wp-customize-widgets.php on line 923

URL Path: /wp-admin/customize.php
Theme: custom theme without widgets

Change History (20)

#1 follow-up: Image @SirLouen
12 months ago

  • Keywords reporter-feedback added

Reproduction Report

Description

This report can't validate that the issue can be reproduced.

Environment

  • WordPress: 6.7.2
  • PHP: 8.2.28
  • Server: nginx/1.27.4
  • Database: mysqli (Server: 8.4.4 / Client: mysqlnd 8.2.28)
  • Browser: Chrome 134.0.0.0
  • OS: Windows 10/11
  • Theme: Twenty Twenty 2.8
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

Reproduction Steps

  1. Set Twenty Twenty Theme
  2. Go to customizer
  3. Check server logs
  4. ❌ Cant' find any warning in the logs

Actual Results

  1. ❌ Error condition doesn't occur

Additional Notes

@ArtZ91 can you provide further reproduction instructions?
Which theme are you using?
We need your full setup to understand the problem, also consider that there could be an issue in your custom theme's code (or any widget you are using). This is not a support forum, in that case, here you will find better answers

Last edited 12 months ago by SirLouen (previous) (diff)

#2 in reply to: ↑ 1 ; follow-up: Image @ArtZ91
12 months ago

Environment

  • WordPress 6.7.2
  • PHP: 8.1.2
  • Server: Apache/2.4.52 (Ubuntu)
  • Database: mysql Ver 8.0.41-0ubuntu0.22.04.1 for Linux on x86_64 ((Ubuntu))
  • Browser: Chrome 134.0.6998.118
  • Theme: minimal custom theme with empty functions.php
  • MU Plugins: None activated
  • Plugins: None activated

Reproduction Steps

Make and activate minimal custom theme with empty functions.php
Go to customizer
Check server apache2/error.logs

[Sun Mar 23 13:50:07.786408 2025] [php:warn] [pid 1197845] [client X.X.X.X:XXXXX] PHP Warning: Attempt to read property "title" on null in /var/www/mydomain.com/wp-includes/class-wp-customize-widgets.php on line 923, referer: https://mydomnain.com/

Additional Notes

The problem is #available-widgets template trying to access panel title on null, because panel with id widgets is not loaded by WP_Customize_Manager.

This is WP issue, because theme developers are not required to support widgets in their custom themes.

Last edited 12 months ago by ArtZ91 (previous) (diff)

#3 in reply to: ↑ 2 Image @SirLouen
12 months ago

Make and activate minimal custom theme with empty functions.php
Go to customizer
Check server apache2/error.logs

How do you expect anyone can reproduce this without the custom minimal theme code?

#4 follow-up: Image @ArtZ91
12 months ago

https://developer.wordpress.org/themes/classic-themes/your-first-theme/#classic-theme

Step 1 – Create a theme folder

Step 2 – Create a style.css file

https://gist.github.com/philiparthurmoore/0496a9b659c12280666d

Step 3 – Create an index.php file

https://gist.github.com/philiparthurmoore/b1f47c15d3eb2c573924

Step 4 – Install Your Theme

Step 5 – Activate Your Theme

#5 in reply to: ↑ 4 Image @SirLouen
12 months ago

  • Keywords reporter-feedback removed
  • Resolution set to invalid
  • Status changed from new to closed

Replying to ArtZ91:

https://developer.wordpress.org/themes/classic-themes/your-first-theme/#classic-theme

Step 1 – Create a theme folder

Step 2 – Create a style.css file

https://gist.github.com/philiparthurmoore/0496a9b659c12280666d

Step 3 – Create an index.php file

https://gist.github.com/philiparthurmoore/b1f47c15d3eb2c573924

Step 4 – Install Your Theme

Step 5 – Activate Your Theme

@ArtZ91
I suggest you move into the next chapter on building your first theme:
https://developer.wordpress.org/themes/basics/

That is not enough to fully build a classic theme, you are barely scraping the surface.
For example, there is a whole topic on theme functions:
https://developer.wordpress.org/themes/basics/theme-functions/

As I said, this is not a forum to learn about WordPress development, this is only for WordPress issues reports.

Please refer to this forum if you have further questions on how to build your first theme if you can't find the info in the URLs I provided you.

#6 Image @ArtZ91
12 months ago

  • Resolution invalid deleted
  • Status changed from closed to reopened

It's bug in your core, just make proper checks in your template!

I'm not need your help in "basics".

Just say for me, where is described, that custom theme must support this widgets feature? It's optional.

You ask me for minimal theme, I provide it. I can't get you full production website theme, because it's not required to this issue.

Last edited 12 months ago by ArtZ91 (previous) (diff)

Image

This ticket was mentioned in Slack in #core by artz91. View the logs.


12 months ago

#8 Image @audrasjb
12 months ago

  • Keywords needs-patch added
  • Version 6.7.2 deleted

Indeed, this may be something we can fix in Core.

Image

This ticket was mentioned in PR #8568 on WordPress/wordpress-develop by @SirLouen.


12 months ago
#9

  • Keywords has-patch has-unit-tests added; needs-patch removed

After some discussion in Slack I'm going to bring some context to this topic:

I never realized that a theme could have no sidebars but @audrasjb brough this:

This may be something we can improve on Core, or at least something that should be documented.

And the use-case of ArtZ91:

how I see it from my side: my goal as a developer is to create some templates based on a specific design. There are no sidebars, so I don't think I need to implement the widgets feature if it's not going to be used. Any another developer, I think, do the same for local business, and they sometimes not used widgets.

So basically, here I provide a patch to avoid the requirement of a widget sidebar area.

Testing Instructions:

  1. Create a basic classic theme with only style.css and index.php, can follow these two files provided in docs instructions: https://developer.wordpress.org/themes/classic-themes/your-first-theme/#classic-theme
  2. Activate such theme
  3. Go to the theme Customizer
  4. Check server debug.log
  5. Before patch, a warning should appear. After patch warning should be sorted.

Trac ticket: https://core.trac.wordpress.org/ticket/63151

#10 Image @SirLouen
12 months ago

  • Keywords needs-testing has-testing-info added

#11 Image @ArtZ91
12 months ago

The warning was gone for me after the patch, thanks!

#12 Image @audrasjb
12 months ago

  • Milestone changed from Awaiting Review to 6.9
  • Owner set to audrasjb
  • Status changed from reopened to reviewing

Moving for 6.9 consideration

#13 Image @dilipbheda
11 months ago

## Test Report
### Description
The error is logged in the debug.log file when the theme does not register any widgets using the widgets_init action.

I tested it with my own theme by commenting out the add_action( 'widgets_init', 'separate_blog_widgets_init' ); line in the functions.php file, and as a result, the error was logged in the debug.log file.

Theme URL: https://wordpress.org/themes/separate-blog/

Patch tested: https://github.com/WordPress/wordpress-develop/pull/8568

### Environment

  • WordPress: 6.9-alpha-60093-src
  • PHP: 8.2.27
  • Server: nginx/1.27.3
  • Database: mysqli (Server: 8.0.40 / Client: mysqlnd 8.2.27)
  • Browser: Chrome 135.0.0.0
  • OS: Linux
  • Theme: Separate Blog 1.0.7
  • MU Plugins: None activated
  • Plugins:
    • Test Reports 1.2.0

### Actual Results

  1. ✅ Issue resolved with patch.

#14 Image @SirLouen
11 months ago

  • Keywords dev-feedback added; needs-testing removed

@audrasjb ready to be shipped in 6.8.2

#15 Image @wordpressdotorg
10 months ago

  • Keywords has-test-info added; has-testing-info removed

#16 Image @SirLouen
10 months ago

#58183 was marked as a duplicate.

#17 Image @SirLouen
10 months ago

Moving the conversation here from #58183.
@audrasjb: add props for @kraftner, @westonruter, and @SergeyBiryukov for working on this topic back in the day.

Last edited 10 months ago by SirLouen (previous) (diff)

#18 Image @audrasjb
9 months ago

  • Resolution set to fixed
  • Status changed from reviewing to closed

In 60279:

Customize: Prevent errors occuring with Classic Theme without Widgets.

This changeset prevents the customizer from displaying a warning when a classic theme has no widget area.

Props ArtZ91, SirLouen, audrasjb, dilipbheda.
Fixes #63151.

#19 follow-up: Image @mowsteadily
4 months ago

  • Resolution fixed deleted
  • Status changed from closed to reopened

What's the status of the patch for this? We're still seeing this error in 6.8.3 for custom themes that don't have sidebars.

#20 in reply to: ↑ 19 Image @SirLouen
4 months ago

  • Resolution set to fixed
  • Status changed from reopened to closed

Replying to mowsteadily:

What's the status of the patch for this? We're still seeing this error in 6.8.3 for custom themes that don't have sidebars.

This will appear after 6.9, not 6.8.3. You can test this if you download the latest 6.9-beta4

Note: See TracTickets for help on using tickets.