Bug? sanitize_file_name and Call to undefined function wp_get_current_user()
-
Hi, i am not sure what kind of issue this is, or if i have just missed something.
I am developing a plugin with an upload feature. The error occurs on:
WP Version 5.3-alpha-46162 and WP Version 5.2.3I use the function sanitize_file_name() to clean the uploaded file name.
If I upload a file with a name like: as.com.pdf i get the following error:
Uncaught Error: Call to undefined function wp_get_current_user() in wordpress/src/wp-includes/capabilities.php:648 Stack trace: #0 wordpress/src/wp-includes/functions.php(3012): current_user_can('unfiltered_html') #1 wordpress/src/wp-includes/formatting.php(2048): get_allowed_mime_types() #2 wordpress/src/wp-content/plugins/easy-pdf-restaurant-menu-upload/class/class_admin_easy_pdf_restaurant_menu.php(34): sanitize_file_name('as') #3 wordpress/src/wp-content/plugins/easy-pdf-restaurant-menu-upload/nsc_easy-pdf-restaurant-menu.php(48): nsc_easy_pdf_restaurant_menu->nsc_eprm_save_menu('lunch', Array) #4 wordpress/src/wp-settings.php(360): include_once('/var/ in wordpress/src/wp-includes/capabilities.php on line 648
if i upload as.pdf it works.
usage:
sanitize_file_name($uploadedFile["name"]);
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
- The topic ‘Bug? sanitize_file_name and Call to undefined function wp_get_current_user()’ is closed to new replies.