Make PHP 8 compatible: Deprecated create_function(), ReturnTypeWillChange, etc

Created on 25 April 2019, over 5 years ago
Updated 29 March 2023, over 1 year ago

PHP's create_function() has been deprecated as of PHP 7.2. This function is used to create an anonymous function. PHP 5.3 has an alternative to doing this.

To make this module compatible with PHP 8, its usage should be replaced with the remaining alternative.

πŸ› Bug report
Status

Needs review

Version

2.0

Component

Code

Created by

πŸ‡ΊπŸ‡¦Ukraine HitchShock Ukraine

Live updates comments and jobs are added and updated live.
  • PHP 8.0

    The issue particularly affects sites running on PHP version 8.0.0 or later.

Sign in to follow issues

Comments & Activities

Not all content is available!

It's likely this issue predates Contrib.social: some issue and comment data are missing.

  • πŸ‡ΊπŸ‡ΈUnited States sclsweb

    I tried to apply the patch from #9 (querypath-php8-3050692-7.patch), and it did not work. The patch from #3 did apply for us. If you can suggest a different way of patching, I'll try it -- we are keen to upgrade to PHP 8. This was the output:

    patch -p1 --dry-run < querypath-php8-3050692-7.patch
    checking file QueryPath/CssEventHandler.php
    checking file QueryPath/Extension/QPList.php
    checking file QueryPath/Extension/QPTPL.php
    checking file QueryPath/QueryPath.php
    checking file qpa/qpa.classes.inc
    checking file qpa/qpa.info
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED
    checking file qpcache/qpcache.info
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED
    checking file qpcache/qpcache.module
    Hunk #5 FAILED at 309.
    1 out of 5 hunks FAILED
    checking file querypath.admin.inc
    checking file querypath.info
    Hunk #1 FAILED at 3.
    1 out of 1 hunk FAILED
    checking file querypath.install
    checking file querypath.module
    Reversed (or previously applied) patch detected! Assume -R? [n] n
    Apply anyway? [n] n
    Skipping patch.
    1 out of 1 hunk ignored
    checking file querypath_examples.info
    Hunk #1 FAILED at 1.
    1 out of 1 hunk FAILED

  • I won't actually use this module much longer, because it's not supported and I found that in my case I could receive the response as JSON by adding this:

    'headers' => [
      'Content-Type' => 'application/json',
    ],
    

    JSON has much better PHP support. And here's an [XML parsing option](https://stackoverflow.com/a/29840928).

    However, if it helps, here is my patched module:

Production build 0.71.5 2024