WordPress.org

Make WordPress Core

Opened 6 years ago

Closed 4 years ago

#20522 closed enhancement (worksforme)

the sanitize_file_name_chars filter and ch(0)

Reported by: olivM Owned by:
Milestone: Priority: normal
Severity: minor Version:
Component: Formatting Keywords: needs-docs needs-unit-tests
Focuses: Cc:

Description

the sanitize_file_name_chars filter is tricky to use due to the chr(0) ending the array :

both

special_chars[] = $my_char; 

and

array_push($special_chars, $mychar);

have no effect.

so the only way to add some char to the array is to use array_unshift :

array_unshift($special_chars, $mychar);

adding

this is mostly a php issue, but it could be useful to add some notice to the WordPress documentation.

Change History (2)

#1 @SergeyBiryukov
6 years ago

I can't reproduce the issue in PHP 5.2.14 or 5.3.3 (Windows). The first two options seem to work fine.

#2 @nacin
4 years ago

  • Milestone Awaiting Review deleted
  • Resolution set to worksforme
  • Status changed from new to closed
Note: See TracTickets for help on using tickets.