Problem/Motivation
PHP 7 is likely to be released sometime this year and Drupal 8 is incompatible with PHP 7 in several significant ways. This is critical because:
- PHP 7 will be released late this year, deprecating all 5.x versions.
- PHP 5.4 is already in security-fix only, and 5.5 will be as well.
- We expect at least two years of D8 being the primary stable supported release, plus an LTS after that, and active support for 5.6 will even end before that.
- Drupal 8 is MUCH faster on PHP 7, with performance gains that would qualify for the Critical performance issue criteria.
- Drupal 8 is incompatible with PHP 7 in ways that will require BC breaks to significant public APIs, and we have no way of preserving BC while also supporting PHP 7, making it infeasible to add PHP 7 support before Drupal 9 if we don't make these key changes before releasing Drupal 8.
See:
- http://php.net/supported-versions.php
- https://wiki.php.net/rfc/reserve_more_types_in_php_7
- https://wiki.php.net/rfc/reserve_even_more_types_in_php_7
- https://wiki.php.net/rfc/remove_deprecated_functionality_in_php7
Proposed resolution
Fix any obvious things that have been accepted into PHP 7 and are already broken in Drupal 8.
Remaining tasks
Fix the child issues:
- #2461773: SortArrayTest has hardcoded string comparison result values, but these can differ between PHP versions
- Error/Exception handling: #2463285: \Drupal\Core\Utility\Error methods used by _drupal_exception_handler type hint Exception which is a problem in php7
- #2455465: Add mod_php7 check to htaccess
- #2455455: Unicode requirements should check *_encoding for 5.6+
- Drupal\ckeditor\Tests\CKEditorTest
- 3 tests fail with an out of memory, even after raising the memory limit to 768M. This has to be a bug. Two of those happened in core/vendor/symfony/dependency-injection/Symfony/Component/DependencyInjection/Compiler/ServiceReferenceGraphNode.php on line 60, that smells like an endless loop to me...
- The array_count_values() warning in the language/locale tests. I really hoped that would be fixed with the same patch, but apparently not. Opened https://bugs.php.net/bug.php?id=69413
- Segfault in MigrateDrupal6Test
- Null.php in Symfony needs to be renamed
- Drupal\system\Tests\Theme\ThemeTest
- Drupal\system\Tests\Installer\InstallerTest
- Drupal\config\Tests\SchemaCheckTraitTest
Fixed
- #2454441: Rename Typed Data classes to support PHP 7
- #2454447: Split Utility\String class to support PHP 7 (String is a reserved word)
- #2455415: Rename Views plugin classes to support PHP 7
- #2457405: DateTimePlus violates substitution principle of DateTime. Make it support PHP 7
- #2465009: Fix fatal errors in rest and views with PHP 7
- https://bugs.php.net/bug.php?id=69371