Index: link-template.php
===================================================================
--- link-template.php	(revision 7585)
+++ link-template.php	(working copy)
@@ -179,7 +179,7 @@
 			$parentlink = _get_page_link( $object->post_parent ); // Ignores page_on_front
 		else
 			$parentlink = get_permalink( $object->post_parent );
-		if ( ctype_digit($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
+		if ( is_numeric($object->post_name) || false !== strpos(get_option('permalink_structure'), '%category%') )
 			$name = 'attachment/' . $object->post_name; // <permalink>/<int>/ is paged so we use the explicit attachment marker
 		else
 			$name = $object->post_name;

