Support from Acquia helps fund testing for Drupal Acquia logo

Comments

joelstein’s picture

Title: Notice: Undefined variable: size in imagecache_profiles_preprocess_user_picture() » Fix PHP Notices
FileSize
986 bytes

I found another bug in imagecache_profiles_form_user_profile_form_alter(). It needs to check if the 'picture' form item is present, which is won't be if editing one of the profile category forms.

The patch has been updated to fix this.

andypost’s picture

Version: 6.x-1.3 » 6.x-1.x-dev
FileSize
971 bytes

Please, provide a patch against current code from 6.x-1.x git branch...

+++ (clipboard)undefined
@@ -65,7 +65,9 @@
-      $preset = is_numeric($size) ? imagecache_preset($size) : imagecache_preset_by_name($size);
+      if (isset($size)) {
+        $preset = is_numeric($size) ? imagecache_preset($size) : imagecache_preset_by_name($size);
+      }

There's no such code in 6.x-1.x branch. $size was changed to $preset and I'm not sure that logic is correct...

Suppose it's better to add !empty($preset) for previous if statement.

+++ (clipboard)undefined
@@ -221,6 +223,9 @@
+  if (!isset($form['picture'])) {
+    return;
+  }

Any reason to check for this key?

Powered by Dreditor.

joelstein’s picture

Please, provide a patch against current code from 6.x-1.x git branch...

Sorry. I updated the patch. The problem still exists, and this patch fixes it.

Any reason to check for this key?

Yes, because your code depends on the 'picture' form item being present, which it won't be if editing one of the profile category forms (if Profile is installed).

andypost’s picture

Ok, seems good. Let's get more reviews before commit.

PS In future please use diff -u to produce a patch in unified format - it's much easy to see which functions been changed.

andypost’s picture

Status: Needs review » Fixed

commited to 6 & 7 branch

Status: Fixed » Closed (fixed)

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