Support PHP 7.4 EPIC
PHP 7.4 was released November 28, 2019.
This is an epic for tasks associated with upgrading core to be compatible with PHP 7.4, based on https://www.php.net/manual/en/migration74.incompatible.php and https://www.php.net/manual/en/migration74.deprecated.php. I have reviewed potential issues and mention below those that I think we need to work on, or may need to work on.
Here are five subissues that could use some love. Note that I was merely creating issues based on the Release Notes and there may be no more to do than checking nothing is wrong.
I think we need to do whack-a-mole when testing against PHP 7.4 on:
- <?php tag at end of file
- Array-style access of non-arrays: Trying to use values of type null, bool, int, float or resource as an array (such as $null["key"]) will now generate a notice.
- htmlentities() function: htmlentities() will now raise a notice (instead of a strict standards warning) if it is used with an encoding for which only basic entity substitution is supported, in which case it is equivalent to htmlspecialchars().
- Tokenizer: token_get_all() will now emit a T_BAD_CHARACTER token for unexpected characters instead of leaving behind holes in the token stream.
$ grep -R token_get_all ./* ./CRM/Core/CodeGen/Util/ArraySyntaxConverter.php: $tokens = token_get_all($code);
- Nested ternary operations must explicitly use parentheses to dictate the order of the operations. Previously, when used without parentheses, the left-associativity would not result in the expected behaviour in most cases. My grep-foo wasn't good enough to find nested uses of ternary operations.
- Convert any use of array_key_exists() on objects to either isset() or property_exists() to deal with deprecation of array_key_exists function.
- Passing parameters to implode() in reverse order is deprecated, use implode($glue, $parts) instead of implode($parts, $glue).