Остання активність 6 months ago

Версія e3a0007e36f56a303b03c31c760ff63bceee80e1

php54_deprecated_functions Неформатований
1#!/bin/bash
2#
3# PHP 5.4 Deprecated function checker
4#
5# Version: 0.0.3
6#
7# 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
16PWD="/tmp"
17FIND_PHP54_DEPRECATED_LOGLOCATION="php54_deprecated_functions.log"
18OUTPUT=${PWD}/${FIND_PHP54_DEPRECATED_LOGLOCATION}
19
20deprecatedFunctions54=(
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# php 5.4 deprecated
41 mcrypt_generic_end
42 mysql_list_dbs
43)
44
45deprecatedIniDirectives54=(
46# php 5.4
47 register_globals
48 register_long_arrays
49)
50
51len=${#deprecatedFunctions54[*]}
52i=0
53
54echo "Checking for deprectated functions in PHP 5.4 ______________________________________" > ${OUTPUT}
55echo "" >> ${OUTPUT}
56
57while [ $i -lt $len ]; do
58 echo " // checking for '${deprecatedFunctions54[$i]}()'" >> ${OUTPUT}
59 grep -rn --color --include=*.php "^[^#]*[^a-zA-Z_]${deprecatedFunctions54[$i]}[[:space:]]*(" * >> ${OUTPUT};
60 echo "" >> ${OUTPUT}
61 let i++
62done
63
64len=${#deprecatedIniDirectives54[*]}
65i=0
66
67echo "Checking for deprectated ini directives in PHP 5.4 _________________________________" >> ${OUTPUT}
68echo "" >> ${OUTPUT}
69
70while [ $i -lt $len ]; do
71 echo " // checking for '${deprecatedIniDirectives54[$i]}()'" >> ${OUTPUT}
72 grep -rn --color --include=*.php "ini_set[[:space:]]*(['|\"]${deprecatedIniDirectives54[$i]}" * >> ${OUTPUT};
73 echo "" >> ${OUTPUT}
74 let i++
75done