#!/bin/bash # # PHP 5.3 Deprecated function checker # # Version: 0.0.3 # # Author: Michiel Roos # # 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. # PWD="/tmp" FIND_PHP54_DEPRECATED_LOGLOCATION="php54_deprecated_functions.log" OUTPUT=${PWD}/${FIND_PHP54_DEPRECATED_LOGLOCATION} # php 5.4 removed deprecatedFunctions54=( define_syslog_variables import_request_variables session_is_registered session_register session_unregister mysqli_bind_param mysqli_bind_result mysqli_client_encoding mysqli_fetch mysqli_param_count mysqli_get_metadata mysqli_send_long_data mysqli::client_encoding mysqli_stmt::stmt # php 5.4 changed behavior get_magic_quotes_gpc get_magic_quotes_runtime set_magic_quotes_runtime # php 5.4 deprecated mcrypt_generic_end mysql_list_dbs ) # php 5.4 deprecatedIniDirectives54=( register_globals register_long_arrays ) len=${#deprecatedFunctions54[*]} i=0 echo "Checking for deprectated functions in PHP 5.4 ______________________________________" > ${OUTPUT} echo "" >> ${OUTPUT} while [ $i -lt $len ]; do echo " // checking for '${deprecatedFunctions54[$i]}()'" >> ${OUTPUT} grep -rn --color --include=*.php "^[^#]*[^a-zA-Z_]${deprecatedFunctions54[$i]}[[:space:]]*(" * >> ${OUTPUT}; echo "" >> ${OUTPUT} let i++ done len=${#deprecatedIniDirectives54[*]} i=0 echo "Checking for deprectated ini directives in PHP 5.4 _________________________________" >> ${OUTPUT} echo "" >> ${OUTPUT} while [ $i -lt $len ]; do echo " // checking for '${deprecatedIniDirectives54[$i]}()'" >> ${OUTPUT} grep -rn --color --include=*.php "ini_set[[:space:]]*(['|\"]${deprecatedIniDirectives54[$i]}" * >> ${OUTPUT}; echo "" >> ${OUTPUT} let i++ done