[wp-trac] [WordPress Trac] #15955: sanitize_file_name not removing invalid characters properly

WordPress Trac wp-trac at lists.automattic.com
Mon Jan 10 07:51:46 UTC 2011


#15955: sanitize_file_name not removing invalid characters properly
--------------------------+------------------------------
 Reporter:  t31os_        |       Owner:
     Type:  defect (bug)  |      Status:  new
 Priority:  normal        |   Milestone:  Awaiting Review
Component:  Media         |     Version:  3.0.3
 Severity:  normal        |  Resolution:
 Keywords:  needs-patch   |
--------------------------+------------------------------

Comment (by solarissmoke):

 Replying to [ticket:15955 t31os_]:
 > The `sanitize_file_name` function is not filtering alot of character
 entities like the degree symbol, this results in invalid media item paths,
 see the attached images.

 I don't think this is where the problem is - {{{sanitize_file_name}}} only
 filters OS-reserved characters. All others are valid - including things
 like æ, ø, å - and will work fine on UNIX platforms.

 The problem is a bug in PHP itself:
 [http://bugs.php.net/bug.php?id=47096]. On Windows platforms, the PHP
 function {{{move_uploaded_file()}}} converts non-ascii characters bitwise
 into CP1251 format. So the resultant filename isn't what WP asked it to
 be.

-- 
Ticket URL: <http://core.trac.wordpress.org/ticket/15955#comment:2>
WordPress Trac <http://core.trac.wordpress.org/>
WordPress blogging software


More information about the wp-trac mailing list