Last active
March 11, 2016 13:18
-
-
Save waja/6552974 to your computer and use it in GitHub Desktop.
This shell script could be used to parse DocumentRoots for functions and ini directives problematic with PHP 5.4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# PHP 5.4 Deprecated function checker | |
# | |
# Version: 0.0.3 | |
# | |
# Original Author: Michiel Roos <[email protected]> | |
# | |
# 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 |
Indeed, PHP is at 5.5, but Debian is on stable at 5.4! ,)
But nobody runs stale ;-)
Any reason for not including function htmlentities?
No, just missing! ;)
Great! :)
I also suggest adding these two functions:
- html_entity_decode
- get_html_translation_table
@aanton Oh I missed your comment. Anyway, those seems not to be deprecated at least when looking into http://php.net/manual/function.html-entity-decode.php or http://php.net/manual/function.get-html-translation-table.php
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
We’re at 5.5 already though, mind you ;-)