Последняя активность 6 months ago

Версия c9f5efea6832ac999dd4e639655f220f5de23340

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