So no results, then this technique
can often be your saviour
Reduce the problem to the simplest
showing bad behaviour

!.jpg
I had an interesting problem in my development machine. It turned out I was not the first to have the problem. I searched for Crunching… and found TRAC #30052.
So I went about analysing it, discovered what caused my problem, updated the TRAC with my comments concluding that it was probably similar but different.
The next day I tried to reproduce the problem as stated. I couldn’t, but I was able to produce the problem using a different technique; one which I could explain and reproduce on a number of servers.
Problem creation
The simplest way to recreate TRAC #30052 – Add New Media Drag and Drop Hangs on Crunching is:
- Define( WP_DEBUG, ‘true’); in
wp-config.php
- Rename an image to
!.jpg
- Upload it using
Media
>Add New
Unexpected result
The Crunching… never ends and you get to see
Notice: Undefined index: extension in /home/herb/public_html/wp-includes/class-wp-image-editor.php on line 360 18948
Simplest explantion
- WordPress attempts to sanitize the file name by removing special characters
- It goes a bit overboard
- The file name becomes
jpg
- Things are mostly fine until it tries to determine the file extension from the sanitized file name
What’s it supposed to do?
I don’t know. The choices would appear to be:
- Make up a file name, using numbers. e.g. start from 1.jpg
- Tell the user about the problem and ask them to change the file name so that it will work
- Nothing
My preference is for option 1.
But we still have to ask what about processing a file called !.!
NOTES
- The image, a snapshot from Caravan Live at RoSfest 2014 which I called
!.jpg
, did successfully upload to this site. It was given a file name ofunnamed-file.jpg
. - Its attachment ID is 671.
- The TRAC is still open; TRAC #30052 – Add New Media Drag and Drop Hangs on Crunching
- But it looks like I could close it. So long as I retest with an attachment ID > 1000.
- This problem was copied and cobbled from https://herbmiller.me/problem-solving-verse-20-simplify/
Reference: