WordPress.org

Make WordPress Core

Opened 3 years ago

Closed 3 years ago

Last modified 3 years ago

#22032 closed defect (bug) (duplicate)

Beta insert media sometimes fails

Reported by: mark8barnes Owned by: koopersmith
Milestone: Priority: normal
Severity: normal Version: 3.5
Component: Media Keywords:
Focuses: Cc:

Description

On 3.5 beta 1, inserting an image sometimes fails, causing a javascript error in a bunch of minified javascript I don't understand (line 467 of load-scripts.php).

Chrome: Uncaught TypeError: Cannot read property 'width' of undefined

Firefox: TypeError: e is undefined

The error seems to occur on any image that are below a certain size. It certainly occurs with images that are 250x250, 200x200 and 200x150.

Attachments (3)

jIMG_0683.jpg (27.1 KB) - added by mark8barnes 3 years ago.
Example image that fails to insert
chrome-screenshot.png (149.3 KB) - added by mark8barnes 3 years ago.
Chrome trace stack
chrome-debug.png (164.2 KB) - added by mark8barnes 3 years ago.
Chrome variables

Download all attachments as: .zip

Change History (11)

@mark8barnes3 years ago

Example image that fails to insert

comment:1 @anointed3 years ago

Glad I found the error report, I am having the same issue since updating to beta1.

If I insert an image into a post when in visual mode and save draft the image disappears.

If I am in 'txt' mode instead of visual mode when saving the draft, then the image stays. Seems to be an issue with the visual editor js

comment:2 follow-up: @koopersmith3 years ago

  • Keywords reporter-feedback added; needs-patch removed
  • Milestone changed from Awaiting Review to 3.5
  • Owner set to koopersmith
  • Severity changed from critical to normal
  • Status changed from new to accepted

It will be easier for us to track down the bug with a little more information. Could you try reproducing the error after setting WP_DEBUG and SCRIPT_DEBUG to true? I've included instructions at the end of this comment.

If you do manage to reproduce the error, please open your browser's JavaScript console and screenshot the error. If you are using Chrome or Safari, expand the error before taking the screenshot. If you can navigate to the affected code, please take a screenshot of that as well, even if you don't know what it means or if it is minified.

Thanks!

How to turn on WP_DEBUG and SCRIPT_DEBUG

  1. Open wp-config.php
  2. Find the line that says define( 'WP_DEBUG', false ); — if you haven't changed your wp-config.php file, it should be around line 81.
  3. Change the false in that line to true.
  4. Right below that line, add define( 'SCRIPT_DEBUG', true );
  5. Save
Last edited 3 years ago by SergeyBiryukov (previous) (diff)

comment:3 @anointed3 years ago

https://dl.dropbox.com/u/2045194/size-is-undefined.jpg

https://dl.dropbox.com/u/2045194/size-is-undefined2.jpg

The error only flashes on for a second when I click save draft or publish, then disappears.
Nothing remains in the error logs or console for me to copy and paste. Normally when there is an error I have no problem going into the console and copy paste the error, but like I said, this one shows just for a split second upon submit, then disappears (fixes itself) but the images are always removed. Hope it helps.

comment:4 in reply to: ↑ 2 @mark8barnes3 years ago

  • Keywords dev-feedback added; reporter-feedback removed

Sorry, I forgot about SCRIPT_DEBUG. Attached are two screenshots, the first showing the error in Chrome's console, the second showing the important variables immediately before the error. You'll see it's caused because props.size is set to 'medium', but 'medium' doesn't exist in attachment.

@mark8barnes3 years ago

Chrome trace stack

@mark8barnes3 years ago

Chrome variables

comment:5 @coolmann3 years ago

Same here, just upgraded to 3.5 beta 1 and I can't add images to posts.

Beta Media doesn't work at all, the old function adds the image to my post, but as soon as I save the draft or publish it, the image is gone.

Same error as Mark's, in Chrome Trace Stack. Tried with IE9, same behavior. No other errors are shown with DEBUG mode enabled, other then the JS error.

I can't even switch to HTML mode in TinyMCE, while the image is being displayed in Visual mode (before saving the draft).

I disabled all my plugins and renamed my functions.php, but it didn't help.

Last edited 3 years ago by coolmann (previous) (diff)

comment:6 @coolmann3 years ago

Could this bug be related to #21776 ?

Last edited 3 years ago by SergeyBiryukov (previous) (diff)

comment:7 @koopersmith3 years ago

  • Keywords dev-feedback removed
  • Milestone 3.5 deleted
  • Resolution set to duplicate
  • Status changed from accepted to closed

Duplicate of #22124.

comment:8 @koopersmith3 years ago

Thanks for the screenshots, mark8barnes, they were quite helpful. This bug was fixed in [22140].

Note: See TracTickets for help on using tickets.