php54_deprecated_functions
· 2.0 KiB · Text
Исходник
#!/bin/bash
#
# PHP 5.4 Deprecated function checker
#
# Version: 0.0.3
#
# Original Author: Michiel Roos <michiel@donationbasedhosting.org>
#
# http://www.php.net/manual/de/migration54.incompatible.php
# http://www.php.net/manual/en/migration54.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}
deprecatedFunctions54=(
# php 5.4 removed
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
array_combine
htmlspecialchars
htmlentities
ob_start
# php 5.4 deprecated
mcrypt_generic_end
mysql_list_dbs
)
deprecatedIniDirectives54=(
# php 5.4
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
| 1 | #!/bin/bash |
| 2 | # |
| 3 | # PHP 5.4 Deprecated function checker |
| 4 | # |
| 5 | # Version: 0.0.3 |
| 6 | # |
| 7 | # Original Author: Michiel Roos <michiel@donationbasedhosting.org> |
| 8 | # |
| 9 | # http://www.php.net/manual/de/migration54.incompatible.php |
| 10 | # http://www.php.net/manual/en/migration54.deprecated.php |
| 11 | # |
| 12 | # Please note that there will be some false positives. Some PHP code is mixed |
| 13 | # with JS code. In JS 'split' is still a valid function. |
| 14 | # |
| 15 | |
| 16 | PWD="/tmp" |
| 17 | FIND_PHP54_DEPRECATED_LOGLOCATION="php54_deprecated_functions.log" |
| 18 | OUTPUT=${PWD}/${FIND_PHP54_DEPRECATED_LOGLOCATION} |
| 19 | |
| 20 | deprecatedFunctions54=( |
| 21 | # php 5.4 removed |
| 22 | define_syslog_variables |
| 23 | import_request_variables |
| 24 | session_is_registered |
| 25 | session_register |
| 26 | session_unregister |
| 27 | mysqli_bind_param |
| 28 | mysqli_bind_result |
| 29 | mysqli_client_encoding |
| 30 | mysqli_fetch |
| 31 | mysqli_param_count |
| 32 | mysqli_get_metadata |
| 33 | mysqli_send_long_data |
| 34 | mysqli::client_encoding |
| 35 | mysqli_stmt::stmt |
| 36 | # php 5.4 changed behavior |
| 37 | get_magic_quotes_gpc |
| 38 | get_magic_quotes_runtime |
| 39 | set_magic_quotes_runtime |
| 40 | array_combine |
| 41 | htmlspecialchars |
| 42 | htmlentities |
| 43 | ob_start |
| 44 | # php 5.4 deprecated |
| 45 | mcrypt_generic_end |
| 46 | mysql_list_dbs |
| 47 | ) |
| 48 | |
| 49 | deprecatedIniDirectives54=( |
| 50 | # php 5.4 |
| 51 | register_globals |
| 52 | register_long_arrays |
| 53 | ) |
| 54 | |
| 55 | len=${#deprecatedFunctions54[*]} |
| 56 | i=0 |
| 57 | |
| 58 | echo "Checking for deprectated functions in PHP 5.4 ______________________________________" > ${OUTPUT} |
| 59 | echo "" >> ${OUTPUT} |
| 60 | |
| 61 | while [ $i -lt $len ]; do |
| 62 | echo " // checking for '${deprecatedFunctions54[$i]}()'" >> ${OUTPUT} |
| 63 | grep -rn --color --include=*.php "^[^#]*[^a-zA-Z_]${deprecatedFunctions54[$i]}[[:space:]]*(" . >> ${OUTPUT}; |
| 64 | echo "" >> ${OUTPUT} |
| 65 | let i++ |
| 66 | done |
| 67 | |
| 68 | len=${#deprecatedIniDirectives54[*]} |
| 69 | i=0 |
| 70 | |
| 71 | echo "Checking for deprectated ini directives in PHP 5.4 _________________________________" >> ${OUTPUT} |
| 72 | echo "" >> ${OUTPUT} |
| 73 | |
| 74 | while [ $i -lt $len ]; do |
| 75 | echo " // checking for '${deprecatedIniDirectives54[$i]}()'" >> ${OUTPUT} |
| 76 | grep -rn --color --include=*.php "ini_set[[:space:]]*(['|\"]${deprecatedIniDirectives54[$i]}" . >> ${OUTPUT}; |
| 77 | echo "" >> ${OUTPUT} |
| 78 | let i++ |
| 79 | done |
| 80 |