Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. usages of $this->$property['prop'] (e.g. in kDBList)
  2. usage of references inside foreach
  3. classes having method named the same as class name (the PHP4 constructor) are now deprecated
  4. usage of $HTTP_RAW_POST_DATA

Solution

The following BASH script can be used to detect some of potentially problematic places:

Code Block
languagebash
#!/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 

Related Tasks

Jira Legacy
serverSystem JiraIn-Portal Issue Tracker
serverId513b375f126bf1dc-8291b574-33133522-9d9f8c14-704c39b1f9153dd94dfb9de1
keyINP-1436