#!/bin/bash
#
# PHP 5.3 Deprecated function checker
#
# Version: 0.0.3
#
# Author: Michiel Roos <[email protected]>
#
# http://www.php.net/manual/en/migration53.deprecated.php
#
# Please note that there will be some false positives. Some PHP code is mixed
# with JS code. In JS 'split' is still a valid function.
#
deprecatedFunctions=(
call_user_method
call_user_method_array
define_syslog_variables
dl
ereg
ereg_replace
eregi
eregi_replace
set_magic_quotes_runtime
session_register
session_unregister
session_is_registered
set_socket_blocking
split
spliti
sql_regcase
mysql_db_query
mysql_escape_string
)
deprecatedIniDirectives=(
define_syslog_variables
register_globals
register_long_arrays
safe_mode
magic_quotes_gpc
magic_quotes_runtime
magic_quotes_sybase
)
len=${#deprecatedFunctions[*]}
i=0
echo "Checking for deprectated functions ______________________________________"
echo ""
while [ $i -lt $len ]; do
echo " // checking for '${deprecatedFunctions[$i]}()'"
grep -rn --color --include=*.php "^[^#]*[^a-zA-Z_]${deprecatedFunctions[$i]}[[:space:]]*(" *;
echo ""
let i++
done
len=${#deprecatedIniDirectives[*]}
i=0
echo "Checking for deprectated ini directives _________________________________"
echo ""
while [ $i -lt $len ]; do
echo " // checking for '${deprecatedIniDirectives[$i]}()'"
grep -rn --color --include=*.php "ini_set[[:space:]]*(['|\"]${deprecatedIniDirectives[$i]}" *;
echo ""
let i++
done