There will be changes in PHP 7, that will break backwards compatibility and this is an umbrella discussion so that we can pinpoint and fix all of them.
- usages of $this->$property['prop'] (e.g. in kDBList)
- usage of references inside
foreach
- classes having method named the same as class name (the PHP4 constructor) are now deprecated
- usage of $HTTP_RAW_POST_DATA
Solution
The following BASH script can be used to detect some of potentially problematic places:
#!/usr/bin/env bash # Credits for regular expressions goes to Adam Harvey (@LGnome). case "$1" in indirect_references) REGEXP='((((::)|(->))\$[a-zA-Z_][a-zA-Z0-9_]*)+\[[^\s]+\]\(\))|(->\$[a-zA-Z_][a-zA-Z0-9_]*\[)|(\$\$[a-zA-Z_][a-zA-Z0-9_]*\[)' ;; engine_exceptions) REGEXP='catch\s*\(\\?Exception\s' ;; foreach) REGEXP='foreach.*\sas\s+&' ;; *) echo $"Usage: $0 {indirect_references|engine_exceptions|foreach} {folder}" exit 1 esac if [ $# -eq 1 ]; then FOLDER="." else FOLDER=$2 fi find $FOLDER -type f -name "*.php" -not -path "*/vendor/*" -print0 | pv | xargs --null grep --color=always --line-number -E $REGEXP