Tested with PHP 7.1.6, when uploading a picture against a user the following warning appears:
Warning: A non-numeric value encountered in user_validate_picture() (line 692 of modules/user/user.module).

A typecast should resolve this:

  function user_validate_picture(&$form, &$form_state) {
    // If required, validate the uploaded picture.
    $validators = array(
      'file_validate_is_image' => array(),
      'file_validate_image_resolution' => array(variable_get('user_picture_dimensions', '85x85')),
-     'file_validate_size' => array(variable_get('user_picture_file_size', '30') * 1024),
+     'file_validate_size' => array((int)variable_get('user_picture_file_size', '30') * 1024),
    );
    ...
  }

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

MustangGB created an issue. See original summary.

MustangGB’s picture

Issue summary: View changes
Ayesh’s picture

PHP 7.1 upgrade notice: http://php.net/manual/en/migration71.other-changes.php#migration71.other....

To reproduce, open the Account settings form, clear the "Picture upload file size" configuration field, and submit. The form element's element_validate_integer_positive validation is not enforced for blank values.

Attached patch.

MustangGB’s picture

Status: Needs review » Reviewed & tested by the community

We both agree, so that should be enough to RTBC.

Vj’s picture

Issue summary: View changes
FileSize
114.15 KB

I have tested patch works fine with Drupal 7 & PHP 7.

Without patch gives warning.

After patch no warning.

David_Rothstein’s picture

Status: Reviewed & tested by the community » Fixed

This looks good, since the variable is already required to be an integer anyway.

Technically the fact that this bug exists means we are missing some test coverage, but I don't think it's worth the effort or entirely fair to make this issue responsible for adding it. Better to just do the simple bug fix here.

Committed to 7.x - thanks!

  • David_Rothstein committed 44c3884 on 7.x
    Issue #2899679 by Ayesh, Vj, MustangGB: PHP7 warning when uploading a...

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

webservant316’s picture

works for me

webservant316’s picture

Can this patch be committed to core? It is not included with 7.60.