#62767 closed defect (bug) (fixed)
Featured image: media-models.min.js?ver=6.8-alpha-59568:2 Uncaught TypeError: t.get is not a function
Reported by: |
|
Owned by: |
|
---|---|---|---|
Milestone: | 6.8 | Priority: | normal |
Severity: | normal | Version: | trunk |
Component: | Media | Keywords: | has-test-info has-patch commit |
Focuses: | javascript, administration | Cc: |
Description
- Create fresh environment
- Install WP beta and update env to WP 6.8 nightly
- Add several media files (I have 1 .png and 2 .jpg files)
- Create new post
- Click 'Set featured image' and select Media Library tab
Actual result: Media files are not displayed. Console error:
media-models.min.js?ver=6.8-alpha-59568:2 Uncaught TypeError: t.get is not a function
at n.comparator (media-models.min.js?ver=6.8-alpha-59568:2:5574)
at e.comparator (media-views.min.js?ver=6.8-alpha-59568:2:7431)
at Array.sort (<anonymous>)
at n.sort (backbone.min.js?ver=1.6.0:2:11690)
at n.set (backbone.min.js?ver=1.6.0:2:10286)
at n.add (backbone.min.js?ver=1.6.0:2:8973)
at n.validate (media-models.min.js?ver=6.8-alpha-59568:2:2968)
at n._validateHandler (media-models.min.js?ver=6.8-alpha-59568:2:3961)
at p (backbone.min.js?ver=1.6.0:2:3818)
at f (backbone.min.js?ver=1.6.0:2:3497)
Attachments (2)
Change History (15)
#1
@
7 months ago
Hi
I have uploaded your remote screenshot to the ticket.
I am not able to reproduce the problem on 6.8 alpha, but I used WordPress trunk, not the beta tester plugin nightly.
Windows 11. Chrome Version 131.0.6778.205.
`
### wp-core ###
version: 6.8-alpha-59274-src
site_language: en_US
user_language: en_US
timezone: +00:00
permalink: /%year%/%monthnum%/%day%/%postname%/
https_status: false
multisite: false
user_registration: 0
blog_public: 1
default_comment_status: open
environment_type: local
user_count: 1
dotorg_communication: true
### wp-paths-sizes ###
wordpress_path: /var/www/src
wordpress_size: 99.23 MB (104050413 bytes)
uploads_path: /var/www/src/wp-content/uploads
uploads_size: 94.78 KB (97052 bytes)
themes_path: /var/www/src/wp-content/themes
themes_size: 44.97 MB (47152710 bytes)
plugins_path: /var/www/src/wp-content/plugins
plugins_size: 2.64 KB (2708 bytes)
fonts_path: /var/www/src/wp-content/uploads/fonts
fonts_size: 0.00 B (0 bytes)
database_size: 2.80 MB (2932736 bytes)
total_size: 147.09 MB (154235619 bytes)
### wp-active-theme ###
name: Twenty Twenty-Three (twentytwentythree)
version: 1.6
author: the WordPress team
author_website: https://wordpress.org
parent_theme: none
theme_features: core-block-patterns, post-thumbnails, responsive-embeds, editor-styles, html5, automatic-feed-links, widgets-block-editor, block-templates
theme_path: /var/www/src/wp-content/themes/twentytwentythree
auto_update: Disabled
### wp-themes-inactive (14) ###
Twenty Eleven: version: 4.8, author: the WordPress team, Auto-updates disabled
Twenty Fifteen: version: 3.9, author: the WordPress team, Auto-updates disabled
Twenty Fourteen: version: 4.1, author: the WordPress team, Auto-updates disabled
Twenty Nineteen: version: 3.0, author: the WordPress team, Auto-updates disabled
Twenty Seventeen: version: 3.8, author: the WordPress team, Auto-updates disabled
Twenty Sixteen: version: 3.4, author: the WordPress team, Auto-updates disabled
Twenty Ten: version: 4.3, author: the WordPress team, Auto-updates disabled
Twenty Thirteen: version: 4.3, author: the WordPress team, Auto-updates disabled
Twenty Twelve: version: 4.4, author: the WordPress team, Auto-updates disabled
Twenty Twenty: version: 2.8, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Five: version: 1.0, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Four: version: 1.3, author: the WordPress team, Auto-updates disabled
Twenty Twenty-One: version: 2.4, author: the WordPress team, Auto-updates disabled
Twenty Twenty-Two: version: 1.9, author: the WordPress team, Auto-updates disabled
### wp-plugins-inactive (1) ###
Hello Dolly: version: 1.7.2, author: Matt Mullenweg, Auto-updates disabled
### wp-media ###
image_editor: WP_Image_Editor_Imagick
imagick_module_version: 1691
imagemagick_version: ImageMagick 6.9.11-60 Q16 x86_64 2021-01-25 https://imagemagick.org
imagick_version: 3.7.0
file_uploads: 1
post_max_size: 1G
upload_max_filesize: 1G
max_effective_size: 1 GB
max_file_uploads: 20
imagick_limits:
imagick::RESOURCETYPE_AREA: 122 MB
imagick::RESOURCETYPE_DISK: 1073741824
imagick::RESOURCETYPE_FILE: 786432
imagick::RESOURCETYPE_MAP: 512 MB
imagick::RESOURCETYPE_MEMORY: 256 MB
imagick::RESOURCETYPE_THREAD: 1
imagick::RESOURCETYPE_TIME: 9.2233720368548E+18
imagemagick_file_formats: 3FR, 3G2, 3GP, AAI, AI, APNG, ART, ARW, AVI, AVIF, AVS, BGR, BGRA, BGRO, BIE, BMP, BMP2, BMP3, BRF, CAL, CALS, CANVAS, CAPTION, CIN, CIP, CLIP, CMYK, CMYKA, CR2, CR3, CRW, CUR, CUT, DATA, DCM, DCR, DCX, DDS, DFONT, DJVU, DNG, DOT, DPX, DXT1, DXT5, EPDF, EPI, EPS, EPS2, EPS3, EPSF, EPSI, EPT, EPT2, EPT3, ERF, EXR, FAX, FILE, FITS, FRACTAL, FTP, FTS, G3, G4, GIF, GIF87, GRADIENT, GRAY, GRAYA, GROUP4, GV, H, HALD, HDR, HEIC, HISTOGRAM, HRZ, HTM, HTML, HTTP, HTTPS, ICB, ICO, ICON, IIQ, INFO, INLINE, IPL, ISOBRL, ISOBRL6, J2C, J2K, JBG, JBIG, JNG, JNX, JP2, JPC, JPE, JPEG, JPG, JPM, JPS, JPT, JSON, K25, KDC, LABEL, M2V, M4V, MAC, MAGICK, MAP, MASK, MAT, MATTE, MEF, MIFF, MKV, MNG, MONO, MOV, MP4, MPC, MPG, MRW, MSL, MSVG, MTV, MVG, NEF, NRW, NULL, ORF, OTB, OTF, PAL, PALM, PAM, PANGO, PATTERN, PBM, PCD, PCDS, PCL, PCT, PCX, PDB, PDF, PDFA, PEF, PES, PFA, PFB, PFM, PGM, PGX, PICON, PICT, PIX, PJPEG, PLASMA, PNG, PNG00, PNG24, PNG32, PNG48, PNG64, PNG8, PNM, POCKETMOD, PPM, PREVIEW, PS, PS2, PS3, PSB, PSD, PTIF, PWP, RADIAL-GRADIENT, RAF, RAS, RAW, RGB, RGBA, RGBO, RGF, RLA, RLE, RMF, RW2, SCR, SCT, SFW, SGI, SHTML, SIX, SIXEL, SPARSE-COLOR, SR2, SRF, STEGANO, SUN, SVG, SVGZ, TEXT, TGA, THUMBNAIL, TIFF, TIFF64, TILE, TIM, TTC, TTF, TXT, UBRL, UBRL6, UIL, UYVY, VDA, VICAR, VID, VIDEO, VIFF, VIPS, VST, WBMP, WEBM, WEBP, WMF, WMV, WMZ, WPG, X, X3F, XBM, XC, XCF, XPM, XPS, XV, XWD, YCbCr, YCbCrA, YUV
gd_version: bundled (2.1.0 compatible)
gd_formats: GIF, JPEG, PNG, WebP, BMP
ghostscript_version: 9.53.3
### wp-server ###
server_architecture: Linux 5.15.167.4-microsoft-standard-WSL2 x86_64
httpd_software: nginx/1.25.3
php_version: 8.2.12 64bit
php_sapi: fpm-fcgi
max_input_variables: 1000
time_limit: 30
memory_limit: 128M
admin_memory_limit: 256M
max_input_time: -1
upload_max_filesize: 1G
php_post_max_size: 1G
curl_version: 7.74.0 OpenSSL/1.1.1w
suhosin: false
imagick_availability: true
pretty_permalinks: true
current: 2025-01-02T09:53:10+00:00
utc-time: Thursday, 02-Jan-25 09:53:10 UTC
server-time: 2025-01-02T09:53:08+00:00
### wp-database ###
extension: mysqli
server_version: 8.0.37
client_version: mysqlnd 8.2.12
max_allowed_packet: 67108864
max_connections: 151
### wp-constants ###
WP_HOME: undefined
WP_SITEURL: undefined
WP_CONTENT_DIR: /var/www/src/wp-content
WP_PLUGIN_DIR: /var/www/src/wp-content/plugins
WP_MEMORY_LIMIT: 40M
WP_MAX_MEMORY_LIMIT: 256M
WP_DEBUG: true
WP_DEBUG_DISPLAY: true
WP_DEBUG_LOG: true
SCRIPT_DEBUG: true
WP_CACHE: false
CONCATENATE_SCRIPTS: undefined
COMPRESS_SCRIPTS: undefined
COMPRESS_CSS: undefined
WP_ENVIRONMENT_TYPE: local
WP_DEVELOPMENT_MODE: core
DB_CHARSET: utf8
DB_COLLATE: undefined
### wp-filesystem ###
wordpress: writable
wp-content: writable
uploads: writable
plugins: writable
themes: writable
fonts: writable
`
#4
@
6 months ago
- Keywords has-testing-info added
Reproduction Report
Description
This report validates that the issue can be reproduced with mentioned steps in the main ticket
Environment
- WordPress: 6.8-alpha-59565
- PHP: 8.3.14
- Server: nginx/1.26.2
- Database: mysqli (Server: 10.5.27-MariaDB-ubu2004-log / Client: mysqlnd 8.3.14)
- Browser: Chrome 131.0.0.0
- OS: Linux
- Theme: Twenty Ten 4.3
- MU Plugins: None activated
- Plugins:
- Test Reports 1.2.0
- WordPress Beta Tester 3.6.2
Actual Results
- ✅ Error condition occurs (reproduced).
Additional Notes
- Tested on a site with many images in media library, only the latest image is displayed and has the same console error
Supplemental Artifacts
Add as Attachment
#5
@
6 months ago
- Focuses javascript added
I am personally still unable to reproduce it, but after discussing with @afercia and @SergeyBiryukov We believe it is caused by the upgrade to uglify-js in [59509] similar to #61519.
@desrosj In my opinion, it is not ideal to keep using and keep reverting to the older version of uglify-js, instead a solution should be found where the script continues to work with the updated uglify-js.
#7
@
6 months ago
I was able to reproduce the issue with a production build (created with npm run build
).
Some notes on reproducing this:
- The bug seems to occur when images are being sorted, so you need to have at least two images in your media library to trigger it.
- It does not appear to make any difference whether
WP_DEBUG
is true or false. SCRIPT_DEBUG
, on the other hand, does make a difference - make sure you do not haveSCRIPT_DEBUG
set to true, because that will cause unminified files to be used. (By defaultSCRIPT_DEBUG
is not set, so this should not be an issue unless you've previously added it to yourwp-config.php
file.)
It seems like the cause of the issue was a change in version 3.18.0 of UglifyJS to "process input as ES module by default":
https://github.com/mishoo/UglifyJS/releases/tag/v3.18.0
In particular it appears to be media-views.js
that is causing the issue - UglifyJS is assuming that it is an ES module, which causes UglifyJS to generate a faulty media-views.min.js
file.
This ticket was mentioned in PR #8219 on WordPress/wordpress-develop by @siliconforks.
6 months ago
#8
- Keywords has-patch added
The behavior of UglifyJS changed in version 3.18.0 to "process input as ES module by default". This can cause issues for scripts which are not ES modules.
Trac ticket: https://core.trac.wordpress.org/ticket/62767
#9
follow-up:
↓ 10
@
5 months ago
Before [59509] I made sure to test in multiple browsers and I was not seeing the same issue. I am also unable to reproduce this in trunk
currently.
This seems like a reasonable path forward, but there is one thing to note that gives me pause to commit. Before applying the PR I see no console errors. After, I see:
Uncaught TypeError: can't access property "value", document.querySelector(...) is null
#10
in reply to:
↑ 9
@
5 months ago
Replying to desrosj:
Before [59509] I made sure to test in multiple browsers and I was not seeing the same issue. I am also unable to reproduce this in
trunk
currently.
I'm still seeing this in the latest trunk (r59766) - not sure why so many people are having trouble reproducing it... You have (at least) 2 images in your media library?
This seems like a reasonable path forward, but there is one thing to note that gives me pause to commit. Before applying the PR I see no console errors. After, I see:
Uncaught TypeError: can't access property "value", document.querySelector(...) is null
I believe that is an unrelated issue that was in trunk at the time I made the pull request a week ago and was later fixed in r59746.
I have just rebased my pull request on the latest trunk version, so that issue should be gone now.
#11
@
5 months ago
- Keywords commit added
- Owner set to desrosj
- Status changed from new to assigned
Thanks the PR is working without errors now.
For my testing, I have tried all combinations of:
SCRIPT_DEBUG
bothtrue
andfalse
(I know,true
shouldn't show the issue).WP_DEBUG
bothtrue
andfalse
- Chrome, Firefox, Safari
- I have 6 images in my media library.
I'm still unsure of why I am unable to reproduce, but since the PR preserves the previous behavior, I think this change makes sense.
Screenshot of JavaScript error