Support » Plugin: WordPress Membership, User Registration, Login Form, User Profile & Restrict Content Plugin â ProfilePress » FIX: media.php on line 647 – non-numeric value
FIX: media.php on line 647 – non-numeric value
-
I fixed the bug where the size name was being passed to a WordPress core function that required numeric values:
PHP Warning: A non-numeric value encountered in /var/www/staging/wp-includes/media.php on line 647
It just involves getting the dimensions from the database before passing them.
https://gist.github.com/BrianHenryIE/754f75c1f79d721a0f2721c9f20a7779
-
Hello,
Thank you very much for your contribution to make this product more useful.Thanks
Thank you so much!
I just downloaded this plugin today and I’m getting the same error.
Warning: A non-numeric value encountered in /<path-to-wp-install>/wp-includes/media.php on line 647 Warning
Hi, please can I have the solution to this problem? I did not understand where I have to correct the code
This error is shown on profile page in WP Admin on my installation.
Hello, I too am facing this same error. I saw the github fix but I’m unclear how to add it or where to add it and what to add?
Open the file
/wp-content/plugins/wp-user-avatar/includes/class-wp-user-avatar-functions.php
Then look for the function
public function wpua_get_avatar_original($id_or_email=””, $size=””, $default=””, $alt=””)
and exchange the code with this:
public function wpua_get_avatar_original($id_or_email="", $size="", $default="", $alt="") { global $avatar_default, $mustache_avatar, $wpua_avatar_default, $wpua_disable_gravatar, $wpua_functions; // Remove get_avatar filter remove_filter('get_avatar', array($wpua_functions, 'wpua_get_avatar_filter')); if((bool) $wpua_disable_gravatar != 1) { // User doesn't have Gravatar and Default Avatar is wp_user_avatar, show custom Default Avatar if(!$wpua_functions->wpua_has_gravatar($id_or_email) && $avatar_default == 'wp_user_avatar') { // Show custom Default Avatar if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) { // $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, array($size,$size)); $size_numeric_w_x_h = array( get_option( $size . '_size_w' ), get_option( $size . '_size_h' ) ); $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, $size_numeric_w_x_h); $default = $wpua_avatar_default_image[0]; } else { $default = $mustache_avatar; } } else { // Get image from Gravatar, whether it's the user's image or default image $wpua_image = get_avatar($id_or_email, $size); // Takes the img tag, extracts the src $output = preg_match_all('/<img.+src=[\'"]([^\'"]+)[\'"].*>/i', $wpua_image, $matches, PREG_SET_ORDER); $default = !empty($matches) ? $matches [0] [1] : ""; } } else { if(!empty($wpua_avatar_default) && $wpua_functions->wpua_attachment_is_image($wpua_avatar_default)) { // $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, array($size,$size)); $size_numeric_w_x_h = array( get_option( $size . '_size_w' ), get_option( $size . '_size_h' ) ); $wpua_avatar_default_image = $wpua_functions->wpua_get_attachment_image_src($wpua_avatar_default, $size_numeric_w_x_h); $default = $wpua_avatar_default_image[0]; } else { $default = $mustache_avatar; } } // Enable get_avatar filter add_filter('get_avatar', array($wpua_functions, 'wpua_get_avatar_filter'), 10, 5); /** * Filter original avatar src * @since 1.9 * @param string $default */ return apply_filters('wpua_get_avatar_original', $default); }
Works! Thank you very much.
This bug is still not fixed, even though a solution was provided?
Is that bugfix only included in the Pro version?
The plugin developer just issued an update to 2.1.6. However, after upgrading to 2.1.6 I still see the error. So I needed to patch the file again.
Maybe the developer is not reading this forum?
it is still not fixed!
I’ve tried everything y’all have said to fix this. There are MANY errors on my page http://www.thetruekungfu.com. And I have no idea how to fix it!!! Ive searched all the codes. I have looked at the debug file. It says False. Can I get some help??
Warning: A non-numeric value encountered in /home/trueadmin/public_html/wp-includes/media.php on line 648…there are many like this!!!
The publicly visible errors can be hidden. Edit your
wp-config.php
, find the linedefine( 'WP_DEBUG_DISPLAY', true );
and changetrue
tofalse
(without quotation marks). If that isn’t found, add it. If that doesn’t work finddefine( 'WP_DEBUG', true );
and set it to false.
- The topic ‘FIX: media.php on line 647 – non-numeric value’ is closed to new replies.