[wp-trac] [WordPress Trac] #36820: Missing data.attachment.sizes property causes javascript error and subsequent blank customization preview

WordPress Trac noreply at wordpress.org
Wed May 11 20:42:43 UTC 2016


#36820: Missing data.attachment.sizes property causes javascript error and
subsequent blank customization preview
----------------------------------+-----------------------------
 Reporter:  Fabio A               |      Owner:
     Type:  defect (bug)          |     Status:  new
 Priority:  normal                |  Milestone:  Awaiting Review
Component:  Customize             |    Version:  4.5.2
 Severity:  normal                |   Keywords:
  Focuses:  javascript, template  |
----------------------------------+-----------------------------
 Suddenly, one of the sites I co-administer stopped showing the
 customizaton preview. Upon investigation, it appeared the problem was
 related to a missing javascript propery property causing the javascript
 engine to stop executing, which lead to a blank customization preview.

 The property is {{{data.attachment.sizes}}} which is accessed at lines 70
 and 74 of [https://core.svn.wordpress.org/tags/4.5.2/wp-includes/customize
 /class-wp-customize-site-icon-control.php wp-includes/customize/class-wp-
 customize-site-icon-control.php].

 I'm not at all into wordpress source code hacking, so I didn't have much
 luck in the short timespan I could allocate for this issue in discovering
 where {{{data}}} actually gets instantiated, and how. I was however able
 to conclude that the already uploaded ''favicon'' lacked the multiple
 sizes the javascript code was expecting, which causes the problem. Indeed,
 removing the old ''favicon'' and uploading a new one fixed the issue.

 As workaround (or you might perhaps consider it a fix) a fake
 {{{data.attachment.sizes}}} could be created if it doesn't exist, filling
 it with the relevant data taken from {{{data.attachment}}}.

 Such a workaround could look like this. Inject this line right after line
 62 in [https://core.svn.wordpress.org/tags/4.5.2/wp-includes/customize
 /class-wp-customize-site-icon-control.php wp-includes/customize/class-wp-
 customize-site-icon-control.php].

 {{{
 <# if ( !data.attachment.sizes ) { data.attachment.sizes = { 'full': {
 'url': data.attachment.url } } }  #>
 }}}

 I tested it before trying to delete and reupload the ''favicon'' and it
 worked.

--
Ticket URL: <https://core.trac.wordpress.org/ticket/36820>
WordPress Trac <https://core.trac.wordpress.org/>
WordPress publishing platform


More information about the wp-trac mailing list