PHPCompatibility v9.3.0 Release Notes

Release Date: 2019-08-29 // over 4 years ago
  • ๐Ÿ‘€ See all related issues and PRs in the 9.3.0 milestone.

    To keep informed of the progress of covering "everything PHP 7.4" in PHPCompatibility, please subscribe to issue #808.

    ๐Ÿ”„ Changes expected in PHPCompatibility 10.0.0

    The next version of PHPCompatibility is expected to include a new external dependency.

    ๐Ÿš€ In this same release, support for PHP < 5.4 and PHP_CodeSniffer < 2.6.0 will be dropped.

    ๐Ÿš€ The 10.0.0 release is expected around the same time as the release of PHP 7.4 - end of November/beginning of December 2019.

    โž• Added

    • ๐Ÿฑ ๐ŸŒŸ New PHPCompatibility.Miscellaneous.NewPHPOpenTagEOF sniff to detect a stand-alone PHP open tag at the end of a file, without trailing newline, as will be supported as of PHP 7.4. #843
    • ๐Ÿท ๐ŸŒŸ New PHPCompatibility.ParameterValues.ForbiddenStripTagsSelfClosingXHTML sniff to detect calls to strip_tags() passing self-closing XHTML tags in the $allowable_tags parameter. This has not been supported since PHP 5.3.4. #866
    • ๐ŸŒŸ New PHPCompatibility.ParameterValues.NewHTMLEntitiesEncodingDefault sniff to detect calls to html_entity_decode(), htmlentities() and htmlspecialchars() which are impacted by the change to the default value of the $encoding parameter in PHP 5.4. #862
    • ๐Ÿฑ ๐ŸŒŸ New PHPCompatibility.ParameterValues.NewIconvMbstringCharsetDefault sniff to detect code impacted by the change in the default_charset value in PHP 5.6. #864 Fixes #839
    • ๐ŸŒŸ New PHPCompatibility.ParameterValues.NewIDNVariantDefault sniff to detect calls to idn_to_ascii() and idn_to_utf8() impacted by the PHP 7.4 change in the default value for the $variant parameter. #861
    • ๐ŸŒŸ New PHPCompatibility.ParameterValues.NewPasswordAlgoConstantValues sniff to detect calls to password_hash() and password_needs_rehash() impacted by the changed value of the PASSWORD_DEFAULT, PASSWORD_BCRYPT, PASSWORD_ARGON2I and PASSWORD_ARGON2ID constants in PHP 7.4. #865
    • ๐Ÿฑ ๐ŸŒŸ New PHPCompatibility.ParameterValues.NewProcOpenCmdArray sniff to detect calls to proc_open() passing an array for the $cmd parameter as supported as of PHP 7.4. #869
    • ๐Ÿท ๐ŸŒŸ New PHPCompatibility.ParameterValues.NewStripTagsAllowableTagsArray sniff to detect calls to strip_tags() passing an array for the $allowable_tags parameter as will be supported as of PHP 7.4. #867
    • ๐Ÿฑ ๐ŸŒŸ New PHPCompatibility.ParameterValues.RemovedImplodeFlexibleParamOrder sniff to detect implode() being called with $glue and $pieces in reverse order from the documented argument order. This was previously allowed for historical reasons, but will be deprecated in PHP 7.4. #846
    • ๐Ÿฑ ๐ŸŒŸ New PHPCompatibility.ParameterValues.RemovedMbStrrposEncodingThirdParam sniff to detect the $encoding being passed as the third, instead of the fourth parameter, to mb_strrpos() as has been soft deprecated since PHP 5.2 and will be hard deprecated as of PHP 7.4. #860
    • ๐Ÿฑ ๐ŸŒŸ New PHPCompatibility.Syntax.RemovedCurlyBraceArrayAccess sniff to detect array and string offset access using curly braces as will be deprecated as of PHP 7.4. #855
      • In contrast to any other sniff in the PHPCompatibility standard, this sniff contains an auto-fixer.
    • ๐Ÿฑ ๐ŸŒŸ New PHPCompatibility.TextStrings.NewUnicodeEscapeSequence sniff to detect use of the PHP 7.0+ unicode codepoint escape sequences and issues with invalid sequences. #856
    • โฌ†๏ธ ๐ŸŒŸ New PHPCompatibility.Upgrade.LowPHP sniff to give users of old PHP versions advance warning when support will be dropped in the near future. #838
      ๐Ÿ‘ At this moment, the intention is to drop support for PHP 5.3 by the end of this year.
    • ๐Ÿฑ โญ๏ธ PHPCompatibility.Classes.NewClasses sniff: recognize the new WeakReference class as introduced in PHP 7.4. #857
    • ๐Ÿฑ โญ๏ธ PHPCompatibility.Constants.NewConstants sniff: detection of new Curl constants as introduced in PHP 7.3.5. #878
    • โญ๏ธ PHPCompatibility.Constants.NewConstants sniff: detection of the revived T_BAD_CHARACTER constant as re-introduced in PHP 7.4. #882
    • โญ๏ธ PHPCompatibility.Constants.NewConstants sniff: detection of the new IMG_FILTER_SCATTER and PASSWORD_ARGON2_PROVIDER constants as introduced in PHP 7.4. #887
    • ๐Ÿฑ โญ๏ธ PHPCompatibility.Constants.RemovedConstants sniff: detection of use of the CURLPIPE_HTTP1 constant which will be deprecated in PHP 7.4. #879
    • โญ๏ธ PHPCompatibility.Constants.RemovedConstants sniff: detection of use of the FILTER_SANITIZE_MAGIC_QUOTES constant which will be deprecated in PHP 7.4. #845
    • โญ๏ธ PHPCompatibility.Constants.RemovedConstants sniff: detection of use of the T_CHARACTER and T_BAD_CHARACTER constants which were removed in PHP 7.0. #882
    • โญ๏ธ PHPCompatibility.FunctionDeclarations.NewMagicMethods sniff: recognize the new __serialize() and __unserialize() magic methods as introduced in PHP 7.4. #868
    • โญ๏ธ PHPCompatibility.FunctionDeclarations.NewMagicMethods sniff: recognize the PHP 5.0 __construct() and __destruct() magic methods. #884
    • โญ๏ธ PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods sniff: recognize the new __serialize() and __unserialize() magic methods as introduced in PHP 7.4. #868
    • ๐Ÿฑ โญ๏ธ PHPCompatibility.FunctionUse.NewFunctions sniff: recognize the new PHP 7.4 function imagecreatefromtga(). #873
    • ๐Ÿฑ โญ๏ธ PHPCompatibility.FunctionUse.RemovedFunctionParameters sniff: recognize the deprecation of the $age parameter of the curl_version() function. #874
    • โญ๏ธ PHPCompatibility.FunctionUse.RemovedFunctions sniff: recognize the PHP 7.4 deprecated convert_cyr_string()(), ezmlm_hash(), get_magic_quotes_gpc(), get_magic_quotes_runtime(), hebrevc(), is_real(), money_format() and restore_include_path() functions. #847
    • โญ๏ธ PHPCompatibility.IniDirectives.NewIniDirectives sniff: detect use of the new PHP 7.4 zend.exception_ignore_args ini directive. #871
    • โญ๏ธ PHPCompatibility.IniDirectives.RemovedIniDirectives sniff: detect use of the allow_url_include ini directive which is deprecated as of PHP 7.4. #870
    • ๐Ÿฑ โญ๏ธ PHPCompatibility.IniDirectives.RemovedIniDirectives sniff: detection of use of the opcache.load_comments directive which was removed in PHP 7.0. #v
    • ๐Ÿฑ โญ๏ธ PHPCompatibility.ParameterValues.NewHashAlgorithms: recognize use of the new PHP 7.4 crc32c hash algorithm. #872
    • ๐Ÿฑ โญ๏ธ PHPCompatibility.TypeCasts.RemovedTypeCasts sniff: detect usage of the (real) type cast which will be deprecated in PHP 7.4. #844
    • ๐Ÿฑ โญ๏ธ Recognize the recode extension functionality which will be removed in PHP 7.4 (moved to PECL) in the RemovedExtensions and RemovedFunctions sniffs. #841
    • ๐Ÿฑ โญ๏ธ Recognize the OPcache extension functionality which was be introduced in PHP 5.5, but not yet fully accounted for in the NewFunctions and NewIniDirectives sniffs. #883
    • ๐Ÿฑ โญ๏ธ New getCompleteTextString() utility method to the PHPCompatibility\Sniff class. #856
    • โฌ†๏ธ โ˜”๏ธ Unit test for the PHPCompatibility.Upgrade.LowPHPCS sniff.
    • ๐Ÿฑ โ˜”๏ธ Some extra unit tests for the PHPCompatibility.ParameterValues.NewNegativeStringOffset, PHPCompatibility.ParameterValues.RemovedMbStringModifiers and sniffs. #876, #877
    • ๐Ÿฑ ๐Ÿ“š CONTRIBUTING.md: Added a list of typical sources for information about changes to PHP. #875

    ๐Ÿ”„ Changed

    • ๐Ÿฑ ๐Ÿ“Œ PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString sniff: the sniff will now also examine the function docblock, if available, and will throw an error when a @throws tag is found in the docblock. #880. Fixes #863
    • ๐Ÿ“Œ PHPCompatibility.FunctionDeclarations.NonStaticMagicMethods sniff: will now also check the visibility and static (or not) requirements of the magic __construct(), __destruct(), __clone(), __debugInfo(), __invoke() and __set_state() methods. #885
    • ๐Ÿฑ ๐Ÿ“Œ PHPCompatibility.Syntax.NewArrayStringDereferencing sniff: the sniff will now also recognize array string dereferencing using curly braces as was (silently) supported since PHP 7.0. #851
      • The sniff will now also throw errors for each dereference found on the array/string, not just the first one.
    • ๐Ÿฑ ๐Ÿ“Œ PHPCompatibility.Syntax.NewClassMemberAccess sniff: the sniff will now also recognize class member access on instantiation and cloning using curly braces as was (silently) supported since PHP 7.0. #852
      • The sniff will now also throw errors for each access detected, not just the first one.
      • The line number on which the error is thrown in now set more precisely.
    • ๐Ÿฑ ๐Ÿ“Œ PHPCompatibility.Syntax.NewFunctionArrayDereferencing sniff: the sniff will now also recognize function array dereferencing using curly braces as was (silently) supported since PHP 7.0. #853
      • The sniff will now also throw errors for each access detected, not just the first one.
      • The line number on which the error is thrown in now set more precisely.
    • ๐Ÿฑ โ™ป๏ธ Various code clean-up and improvements. #849, #850
    • ๐Ÿ“š โ™ป๏ธ Various minor inline documentation fixes. #854, #886
    • ๐Ÿ— ๐Ÿ”ง Travis: various tweaks to the build script. #834, #842

    ๐Ÿ›  Fixed

    • ๐Ÿฑ ๐Ÿ› PHPCompatibility.FunctionDeclarations.ForbiddenParametersWithSameName sniff: variable names are case-sensitive, so recognition of same named parameters should be done in a case-sensitive manner. #848
    • ๐Ÿฑ ๐Ÿ› PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString sniff: Exceptions thrown within a try should not trigger the sniff. #880. Fixes #863
    • ๐Ÿฑ ๐Ÿ› PHPCompatibility.FunctionDeclarations.NewExceptionsFromToString sniff: the $ooScopeTokens property should never have been a public property. #880.
    • ๐Ÿฑ โ˜”๏ธ Some of the unit tests for the PHPCompatibility.Operators.RemovedTernaryAssociativity sniff were not being run. #836