Index: trac/attachment.py
===================================================================
--- trac/attachment.py	(revision 3612)
+++ trac/attachment.py	(working copy)
@@ -219,8 +219,8 @@
             attachment = Attachment(env, parent_type, parent_id)
             attachment.filename = filename
             attachment.description = description
-            attachment.size = size
-            attachment.time = time
+            attachment.size = size and int(size) or 0
+            attachment.time = time and int(time) or 0
             attachment.author = author
             attachment.ipnr = ipnr
             yield attachment

