Skip to content

PHP 7 Updates

Nancy Rackleff edited this page Feb 8, 2019 · 3 revisions

Mark modules that are not working with PHP 7.2 here

Note: Drupal 7 PHP 7.2 compatibility will be in 7.61. Release date was Nov 8.

Two modules that have PHP7 related issues that did not appear in our code compatibility tests

Update steps

Run code compatibility tests

  1. Set your php version to 7.2
  2. Run all tests below and note any modules not part of drupal core (/includes and /modules) and not part of Pantheon (/misc) below in the Modules section.
  3. For each module, look through the issues on drupal.org to see if you can find an existing issue. One should exist in most cases. If so, see if an update to the stable version contains the fix, otherwise use a patch if available.
  4. After updating all the modules, run all the tests again to see if the issues are now gone.
  • composer global require wapmorgan/php-code-fixer dev-master
  • phpcf --target=7.2 --file-extensions="php,module,inc,install,test" ~/Sites/givingforum
    • getting error: Notice: Undefined offset: 1 in wapmorgan/php-code-fixer/data/mb_ereg_replace_e_modifier.php on line 11. Workaround by adding return false; to line 10 of that file.
  • composer global require sstalle/php7cc
  • php7cc ~/Sites/givingforum --extensions="php,module,inc,install,test" --relative-paths --level=error
    • add xdebug.max_nesting_level = 1000 to /usr/local/etc/php/7.2/conf.d/php-ts.ini and do a brew services restart php72
  • git clone git@github.com:Alexia/php7mar.git ~/Projects/php7mar
  • cd ~/Projects/php7mar
  • php mar.php -f="~/Sites/givingforum" -x="php,module,inc,install,test" -t="critical"
    • Ignore the each() function is deprecated error.

PhpStorm

  1. Preferences > Languages & Frameworks > set PHP language level to 7.2.
  2. Code > Run Inspection by Name > Language Level.

Test

Testing details will depend on the specific site we're working on but at minimum, rebuild the site, make sure pages of each content type load properly, check the Drupal logs for any issues. Try to test any functionality that uses any modules that have been updated.

Update Pantheon PHP version

  • Change php_version in pantheon.yml to 7.1.
  • Update drush_version in pantheon.yml to 8.

Modules with compatibility issues detected

  • Drupal core
    • includes/*
    • modules/*
  • misc/healthchecks | Issue
    • This is Pantheon code. Likely won't impact the site.
  • admin_menu | Issue
    • should be fixed, try latest version or dev
    • updated to 3.x-dev (bc712f72c4ce0d1152c86e6d3a7683b48cd0d062)
  • apachesolr | Issue
    • should be fixed, try latest version or dev
    • updated to 1.11
  • braintree library (not the commerce_braintree module)
    • Fixed in 3.26.0, Drupal module ([commerce_braintree (https://www.drupal.org/project/commerce_braintree)) mentions it's tested on 3.21.0. No mention of PHP 7 compatibility or new library testing in issues. https://github.com/braintree/braintree_php
  • context | Issue
    • likely needs a patch
    • added patch for stable version
  • ctools | Issue
    • should be fixed, try latest version or dev
    • updated to 1.14
  • diff | Issue Issue 2
    • Likely needs a patch
    • patched stable version
  • features | Issue
    • Likely needs a patch
  • field_collection | issue
    • patch available
  • hacked | Issue
    • should be fixed, try latest version
  • metatag | Issue
    • Function each() is deprecated.
  • rules | Issue
    • In 7.x-2.11
  • views | Issue
    • should be fixed, try latest version or dev
  • views_bulk_operations | Issue
    • Function create_function() is deprecated.

Issues that are safe to ignore

  • Braintree library
    • ValidationErrorCollectionTest.php:13 | Function create_function() is deprecated.
      • Test code. There was a similar issue with production code which was fixed in 3.26.0
  • devel
    • Division by zero is on purpose
  • feeds
    • libraries/http_request.inc:294 | Ini safe_mode is deprecated.
      • This code checks for PHP version so safe_mode will not be used in deprecated versions.
  • globalredirect
    • globalredirect.test | Function usage assert() (@assert_on_string) is deprecated.
      • Deprecated code is present in .test files. Should not run in production environment.

Clone this wiki locally