For the latest version of this problem please see Add new media drag and drop hangs on Crunching…
So no results, then this technique can often be your saviour Reduce the problem to the simplest showing bad behaviour
I had an interesting problem in my development machine recently. It turns 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/customer/www/herbmiller.me/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 !.!
See also
- TRAC #30052 – Add New Media Drag and Drop Hangs on Crunching
- Problem Solving – Top 10 questions to ask when something doesn’t work
- The image I uploaded is a snapshot from Caravan Live at RoSfest 2014.