SonarSource Rules
  • Products

    In-IDE

    Code Quality and Security in your IDE with SonarQube Ide

    IDE extension that lets you fix coding issues before they exist!

    Discover SonarQube for IDE

    SaaS

    Code Quality and Security in the cloud with SonarQube Cloud

    Setup is effortless and analysis is automatic for most languages

    Discover SonarQube Cloud

    Self-Hosted

    Code Quality and Security Self-Hosted with SonarQube Server

    Fast, accurate analysis; enterprise scalability

    Discover SonarQube Server
  • SecretsSecrets
  • ABAPABAP
  • AnsibleAnsible
  • ApexApex
  • AzureResourceManagerAzureResourceManager
  • CC
  • C#C#
  • C++C++
  • CloudFormationCloudFormation
  • COBOLCOBOL
  • CSSCSS
  • DartDart
  • DockerDocker
  • FlexFlex
  • GitHub ActionsGitHub Actions
  • GoGo
  • HTMLHTML
  • JavaJava
  • JavaScriptJavaScript
  • JSONJSON
  • JCLJCL
  • KotlinKotlin
  • KubernetesKubernetes
  • Objective CObjective C
  • PHPPHP
  • PL/IPL/I
  • PL/SQLPL/SQL
  • PythonPython
  • RPGRPG
  • RubyRuby
  • RustRust
  • ScalaScala
  • ShellShell
  • SwiftSwift
  • TerraformTerraform
  • TextText
  • TypeScriptTypeScript
  • T-SQLT-SQL
  • VB.NETVB.NET
  • VB6VB6
  • XMLXML
  • YAMLYAML
PHP

PHP static code analysis

Unique rules to find Bugs, Vulnerabilities, Security Hotspots, and Code Smells in your PHP code

  • All rules 273
  • Vulnerability42
  • Bug51
  • Security Hotspot34
  • Code Smell146
Filtered: 3 rules found
obsolete
    Impact
      Clean code attribute
        1. Alias functions should not be used

           Code Smell
        2. Deprecated features should not be used

           Code Smell
        3. References should not be passed to function calls

           Code Smell

        Deprecated features should not be used

        consistency - conventional
        maintainability
        Code Smell
        • obsolete

        Why is this an issue?

        More Info

        Deprecated language features are those that have been retained temporarily for backward compatibility, but which will eventually be removed from the language. In effect, deprecation announces a grace period to allow the smooth transition from the old features to the new ones. In that period, no use of the deprecated features should be added to the code, and all existing uses should be gradually removed.

        The following functions were deprecated in PHP 5:

        Deprecated Use Instead

        call_user_method()

        call_user_func()

        call_user_method_array()

        call_user_func_array()

        define_syslog_variables()

        dl()

        ereg()

        preg_match()

        ereg_replace()

        preg_replace() (note that this is deprecated in PHP 5.5)

        eregi()

        preg_match() with 'i' modifier

        eregi_replace()

        preg_replace() with 'i' modifier

        set_magic_quotes_runtime() and its alias, magic_quotes_runtime()

        session_register()

        $_SESSION superglobal

        session_unregister()

        $_SESSION superglobal

        session_is_registered()

        $_SESSION superglobal

        set_socket_blocking()

        stream_set_blocking()

        split()

        preg_split()

        spliti()

        preg_split() with 'i' modifier

        sql_regcase()

        mysql_db_query()

        mysql_select_db() and mysql_query()

        mysql_escape_string()

        mysql_real_escape_string()

        Passing locale category names as strings

        Use the LC_* family of constants

        The following functions were deprecated in PHP 7:

        Deprecated Use Instead

        __autoload()

        spl_autoload_register()

        create_function()

        anonymous function

        parse_str() without second argument

        parse_str() with second argument

        gmp_random()

        gmp_random_bits() or gmp_random_range()

        each()

        foreach

        assert() with string argument

        Defining case-insensitive constants by calling define() with true as third parameter

        define("myconst", $value) or define("myconst", $value, false)

        FILTER_FLAG_SCHEME_REQUIRED and FILTER_FLAG_HOST_REQUIRED flags

        FILTER_VALIDATE_URL flag

        fgetss() function, "string.strip_tags" stream filter name, SplFileObject::fgetss() method and gzgetss() function

        mbregex_encoding(), mbereg(), mberegi(), mbereg_replace(), mberegi_replace(), mbsplit(), mbereg_match(), mbereg_search(), mbereg_search_pos(), mbereg_search_regs(), mbereg_search_init(), mbereg_search_getregs(), mbereg_search_getpos(), mbereg_search_setpos()

        Use the

        corresponding mb_ereg_*() variants instead

        string search functions with integer needle (stristr, strrchr, strstr, strripos, stripos, strrpos, strpos, strchr)

        use a string needle instead

        image2wbmp()

        imagewbmp()

        Normalizer::NONE

        Defining an assert() function inside a namespace

        use the standard assert() function

          Available In:
        • SonarQube IdeCatch issues on the fly,
          in your IDE
        • SonarQube CloudDetect issues in your GitHub, Azure DevOps Services, Bitbucket Cloud, GitLab repositories
        • SonarQube Community BuildAnalyze code in your
          on-premise CI
          Available Since
          9.1
        • SonarQube ServerAnalyze code in your
          on-premise CI
          Developer Edition
          Available Since
          9.1

        © 2008-2025 SonarSource SA. All rights reserved.

        Privacy Policy | Cookie Policy | Terms of Use