فهرست منبع

fixed warning when attachments aren't set

stekkel 22 سال پیش
والد
کامیت
7dec4b6aad
1فایلهای تغییر یافته به همراه11 افزوده شده و 9 حذف شده
  1. 11 9
      src/read_body.php

+ 11 - 9
src/read_body.php

@@ -320,15 +320,17 @@ function ClearAttachments() {
     $hashed_attachment_dir = getHashedDir($username, $attachment_dir);
 
     $rem_attachments = array();
-    foreach ($attachments as $info) {
-        if ($info['session'] == -1) {
-            $attached_file = "$hashed_attachment_dir/$info[localfilename]";
-            if (file_exists($attached_file)) {
-                unlink($attached_file);
-            }
-        } else {
-            $rem_attachments[] = $info;
-        }
+    if (isset($attachments)) {
+	foreach ($attachments as $info) {
+    	    if ($info['session'] == -1) {
+        	$attached_file = "$hashed_attachment_dir/$info[localfilename]";
+        	if (file_exists($attached_file)) {
+            	    unlink($attached_file);
+        	}
+    	    } else {
+        	$rem_attachments[] = $info;
+    	    }
+	}
     }
     $attachments = $rem_attachments;
 }