Make WordPress Core

Opened 5 weeks ago

Closed 5 weeks ago

#63121 closed defect (bug) (fixed)

Cannot Change Logo

Reported by: domainsupport's profile domainsupport Owned by: adamsilverstein's profile adamsilverstein
Milestone: 6.8 Priority: normal
Severity: normal Version: trunk
Component: Customize Keywords: has-patch reporter-feedback has-testing-info commit
Focuses: ui, javascript Cc:

Description

When trying to change the site logo in "Customizer - Site Identity - Change Logo" or in "Dashboard - Settings - General - Change site icon" you can upload / select an image but when it comes to crop the image it won't let you save.

The console errors are ...

[Error] TypeError: undefined is not an object (evaluating 'o.findWhere')
	(anonymous function) (media-views.min.js:2:58362)
	N (load-scripts.php:10:9476)
	refresh (media-views.min.js:2:58246)
	p (backbone.min.js:2:3763)
	(anonymous function) (backbone.min.js:2:3499)
	a (backbone.min.js:2:694)
	(anonymous function) (backbone.min.js:2:3382)
	reset (backbone.min.js:2:10777)
	reset (media-views.min.js:2:6570)
	p (backbone.min.js:2:3649)
	(anonymous function) (backbone.min.js:2:3499)
	a (backbone.min.js:2:694)
	(anonymous function) (backbone.min.js:2:3382)
	(anonymous function) (load-scripts.php:10:10512)
	I (load-scripts.php:10:9612)
	(anonymous function) (load-scripts.php:10:10409)
	(anonymous function) (load-scripts.php:10:1141)
	(anonymous function) (backbone.min.js:2:1305)
	reset (media-views.min.js:2:12905)
	clickSelect (media-views.min.js:2:106371)
	Jn (load-scripts.php:10:7492)
	(anonymous function) (load-scripts.php:10:7803)
	(anonymous function) (load-scripts.php:10:1070)
	click (media-views.min.js:2:12025)
	dispatch (load-scripts.php:2:40041)
[Error] TypeError: undefined is not an object (evaluating 'o.findWhere')
	(anonymous function) (media-views.min.js:2:58362)
	N (load-scripts.php:10:9476)
	refresh (media-views.min.js:2:58246)
	set (media-views.min.js:2:57945)
	initialize (media-views.min.js:2:57214)
	(anonymous function) (backbone.min.js:2:14872)
	constructor (wp-backbone.min.js:2:2608)
	constructor (media-views.min.js:2:54431)
	(anonymous function) (backbone.min.js:2:23904)
	createCropToolbar (media-views.min.js:2:60470)
	p (backbone.min.js:2:3649)
	(anonymous function) (backbone.min.js:2:3499)
	a (backbone.min.js:2:694)
	(anonymous function) (backbone.min.js:2:3382)
	onImageLoad (media-views.min.js:2:89161)
	Jn (load-scripts.php:10:7492)
	(anonymous function) (load-scripts.php:10:7803)
	(anonymous function) (load-scripts.php:10:1070)
	dispatch (load-scripts.php:2:40041)

I'm using un-modified Twenty Twenty-One theme and WordPress v6.8-beta3.

Change History (13)

#1 @joemcgill
5 weeks ago

  • Milestone changed from Awaiting Review to 6.8

Confirmed that I can reproduce this with a fresh install of 6.8 beta 3.

This ticket was mentioned in Slack in #core-media by joemcgill. View the logs.


5 weeks ago

#3 @joedolson
5 weeks ago

This looks like it was caused by [60031]; pinging @adamsilverstein to take a look.

#4 @adamsilverstein
5 weeks ago

Hmm, I guess we can't assume findWhere exists. I'll add some logic to make sure it does.

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


5 weeks ago
#5

  • Keywords has-patch added

#6 follow-up: @adamsilverstein
5 weeks ago

  • Keywords reporter-feedback needs-testing added
  • Owner set to adamsilverstein
  • Status changed from new to assigned

@domainsupport thanks for catching this and reporting. Thanks for the ping @joedolson.

I was able to reproduce the issue and verify the extra check in https://github.com/WordPress/wordpress-develop/pull/8538 fixes the issue. This also keeps the original fix for gallery insertion.

More testing would be good, otherwise I can get this committed.

#7 @joedolson
5 weeks ago

Tested and confirmed that this keeps the fix for #39824 while fixing the issue in the customizer. :thumbsup:

#8 @kawsar007
5 weeks ago

Thanks for sharing the console error details. It looks like the JS code in media-views is attempting to call “o.findWhere” on an undefined object, which likely stems from changes introduced in [60031]. The cropping flow can’t properly locate the selected model in the Backbone collection, hence the “undefined is not an object” error. Checking for an existing model or verifying that “findWhere” is defined should fix the issue.

#9 @AddWeb Solution Pvt. Ltd.
5 weeks ago

  • Keywords has-testing-info added

Test Environment:

WordPress Version: 6.8.1 & 6.8.3 Beta
Theme: Twenty Twenty-One


Test Scenario

Navigate to Appearance → Customize → Site Identity → Change Logo.
Upload or select an image.
The cropping tool appears but does not allow saving.
Similarly, navigate to Dashboard → Settings → General → Change Site Icon.
Upload or select an image, but saving is not possible after cropping.
Check the browser console for JavaScript errors.

Expected Result

The image should be cropped, saved, and set as the site logo or site icon without issues.

Actual Result

The cropping tool appears, but saving does not work.
JavaScript error appears in the browser console.
The issue occurs in both WordPress v6.8.1 and v6.8.3 Beta with the Twenty Twenty-One theme.

Screenshot:
https://prnt.sc/hdrACTXZnP4u
https://prnt.sc/tEc0yTXxFcbW
https://prnt.sc/0h3AVruhU5Sb

Test Conclusion

Status: 🔴 Issue Reproduced
Impact: High (affects core functionality for branding & customization)
Recommendation:

Investigate JavaScript errors in the console.
Check if the issue persists with a different theme or in a fresh installation.
Verify if a plugin conflict is causing the issue by disabling all plugins and testing again.

#10 in reply to: ↑ 6 @domainsupport
5 weeks ago

Replying to adamsilverstein:

@domainsupport thanks for catching this and reporting.

No problem! I love helping to fix stuff :)

This ticket was mentioned in Slack in #core-test by oglekler. View the logs.


5 weeks ago

#12 @adamsilverstein
5 weeks ago

  • Keywords commit added; needs-testing removed

#13 @adamsilverstein
5 weeks ago

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

In 60054:

Customizer: fix logo cropping.

Address a failure in the customizer site logo cropping after r60031. Check to ensure library exists before the call to findWhere.

Follow up to r60031.

Props: domainsupport, joemcgill, joedolson, kawsar007, addweb-solution-pvt-ltd, mukesh27.

Fixes #63121.

Note: See TracTickets for help on using tickets.