Zuletzt aktiv 6 months ago

Änderung fc1d86247331ee0bd151c7a8b09ef6b4112cb745

php54_deprecated_functions Originalformat
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
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 htmlspecialchars
41# php 5.4 deprecated
42 mcrypt_generic_end
43 mysql_list_dbs
44)
45
46deprecatedIniDirectives54=(
47# php 5.4
48 register_globals
49 register_long_arrays
50)
51
52len=${#deprecatedFunctions54[*]}
53i=0
54
55echo "Checking for deprectated functions in PHP 5.4 ______________________________________" > ${OUTPUT}
56echo "" >> ${OUTPUT}
57
58while [ $i -lt $len ]; do
59 echo " // checking for '${deprecatedFunctions54[$i]}()'" >> ${OUTPUT}
60 grep -rn --color --include=*.php "^[^#]*[^a-zA-Z_]${deprecatedFunctions54[$i]}[[:space:]]*(" * >> ${OUTPUT};
61 echo "" >> ${OUTPUT}
62 let i++
63done
64
65len=${#deprecatedIniDirectives54[*]}
66i=0
67
68echo "Checking for deprectated ini directives in PHP 5.4 _________________________________" >> ${OUTPUT}
69echo "" >> ${OUTPUT}
70
71while [ $i -lt $len ]; do
72 echo " // checking for '${deprecatedIniDirectives54[$i]}()'" >> ${OUTPUT}
73 grep -rn --color --include=*.php "ini_set[[:space:]]*(['|\"]${deprecatedIniDirectives54[$i]}" * >> ${OUTPUT};
74 echo "" >> ${OUTPUT}
75 let i++
76done