Make WordPress Core

Opened 5 weeks ago

Last modified 5 weeks ago

#63151 reviewing defect (bug)

[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 needs-testing has-testing-info
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 (12)

#1 follow-up: @SirLouen
5 weeks 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 5 weeks ago by SirLouen (previous) (diff)

#2 in reply to: ↑ 1 ; follow-up: @ArtZ91
5 weeks 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 5 weeks ago by ArtZ91 (previous) (diff)

#3 in reply to: ↑ 2 @SirLouen
5 weeks 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: @ArtZ91
5 weeks 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 @SirLouen
5 weeks 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 @ArtZ91
5 weeks 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 5 weeks ago by ArtZ91 (previous) (diff)

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


5 weeks ago

#8 @audrasjb
5 weeks ago

  • Keywords needs-patch added
  • Version 6.7.2 deleted

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

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


5 weeks 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 @SirLouen
5 weeks ago

  • Keywords needs-testing has-testing-info added

#11 @ArtZ91
5 weeks ago

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

#12 @audrasjb
5 weeks ago

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

Moving for 6.9 consideration

Note: See TracTickets for help on using tickets.