• Problem Solving – verse 20 – Simplify

    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:

    1. Define( WP_DEBUG, ‘true’); in wp-config.php
    2. Rename an image to !.jpg
    3. 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:

    1. Make up a file name, using numbers. e.g. start from 1.jpg
    2. Tell the user about the problem and ask them to change the file name so that it will work
    3. Nothing

    My preference is for option 1.

    But we still have to ask what about processing a file called !.!

    See also


    , ,

    Published:

    Last updated:

    January 6, 2020

Categories

Tide times from tidetimes.org.uk

Tide Times & Heights for Langstone Harbour on
28th March 2023
04:31 High Tide ( 4.23m )
09:38 Low Tide ( 1.66m )
16:58 High Tide ( 4.06m )
21:59 Low Tide ( 1.94m )

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
28th March 2023
04:51 High Tide ( 4.02m )
09:45 Low Tide ( 1.26m )
17:24 High Tide ( 3.79m )
22:09 Low Tide ( 1.6m )
WordPress version:6.1.1
Gutenberg version:15.2.0

Summary file