Support

Account

Home Forums Bug Reports PHP Fatal Error with front-end \'file upload\' field

Helping

PHP Fatal Error with front-end \'file upload\' field

  • Hi Elliot, Thanks as always for the ACF plug-in. Just wanted to let you know that I believe I have found (and am proposing a solution to) a bug.

    Scenario/Bug: A front-end application form where (non-logged-in) users can submit mp3 files for review. When users tried to submit data, the screen would go white and the following PHP error would be logged: Fatal error: Call to undefined function wp_read_audio_metadata() in /wp-admin/includes/image.php on line 134.

    WP/ACF Versions: WordPress 4.2.2 / ACF Pro 5.2.5

    Possible Solution: The wp_read_audio_metadata() function is defined in the file /wp-admin/includes/media.php I looked at the ACF api-helpers.php file and realized that the ‘media.php’ is not being included with the other wp includes files (wp-load.php, file.php, image.php). I went ahead and added an include for media.php right under the ‘image.’php’ includes on line 2458 in ‘api-helpers.php’ and it seemed to do the trick.

    require_once( ABSPATH . “/wp-admin/includes/media.php” );

    Additional Notes: Logged in users weren’t experiencing this bug, probably because they get the full “WP media” uploader experience instead of the default html ‘file’ field that non-logged-in users get.

    OK, hopefully this helps. Let me know if this is an appropriate fix (or if this is problematic, opens security holes, etc.) Thanks again, Elliot!

  • Thanks for the bug report. I’ll see what I can do about getting this information to Elliot.

    ~JH

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.