• 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
9th August 2022
02:38 Low Tide ( 1.67m )
09:44 High Tide ( 4.32m )
15:10 Low Tide ( 1.73m )
22:13 High Tide ( 4.53m )

Tide times from tidetimes.org.uk

Tide Times & Heights for Northney on
9th August 2022
02:47 Low Tide ( 1.11m )
09:54 High Tide ( 4.08m )
15:15 Low Tide ( 1.16m )
22:14 High Tide ( 4.33m )
WordPress version:6.0.1
Gutenberg version:13.7.3

[clone]

[cloned]