public
Description: Fresh Zen Odds and Ends
Homepage: http://davidcancel.com/
Clone URL: git://github.com/dcancel/freshzen.git
freshzen / toolbox / find_php_non_utf8
100755 17 lines (12 sloc) 0.594 kb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#!/bin/bash
 
# Check that required args are present
if [ $# -ne 1 ]; then
echo "Usage: `basename $0` {path}"
  exit -1
fi
 
FIND_CMD="find $1 -name "*.php" -print"
GREP_CMD="grep --line-number -E 'strlen\(|split\(mail\(|strpos\(|strrpos\(|substr\(|strtolower\(|strtoupper\(|substr_count\(|ereg\(|eregi\(|ereg_replace\(|eregi_replace\('"
 
echo "--------------------------------------------------------------------------------"
echo "Searching for non-UTF-8 compliant PHP code"
echo "--------------------------------------------------------------------------------"
 
$FIND_CMD | xargs $GREP_CMD