Problem/Motivation

flow/jsonpath library is no longer maintained, https://github.com/SoftCreatR/JSONPath is the successor.

See the details of which needs to be updated here: https://www.drupal.org/project/feeds_ex/issues/3181642

Issue fork feeds_ex-3181865

Command icon Show commands

Start within a Git clone of the project using the version control instructions.

Or, if you do not have SSH keys set up on git.drupalcode.org:

Comments

tormi created an issue. See original summary.

tormi’s picture

megachriz’s picture

I looked at the requirements of the library and I saw that it requires at least PHP 7.1:

"require": {
    "php": ">=7.1",
    "ext-json": "*"
  },

The D7 version of Feeds Extensible Parsers current minimum PHP version is 5.4. So I'm not sure if we should replace the library in the D7 version at all. An other option is finding a way to support both flow/jsonpath and softcreatr/jsonpath. If that's not possible, I think we would need to create a new major release, because especially sites that are still on D7 are not guaranteed to be able to run on PHP 7.1. Because they may have modules installed that aren't made compatible with that PHP version yet.

SoftCreatR’s picture

@MegaChriz

composer require softcreatr/jsonpath:"^0.5 || ^0.7"

The version 0.5.2 supports PHP 5.4 - 7.0, while the version 0.7 supports PHP 7.1 and newer (tested up to PHP 8.0). When requiring "^0.5 || ^0.7", Composer automatically picks the correct JSONPath version, depending on the PHP version used.

tormi’s picture

The main problem for me is this inaccurate error message, even if I used Composer & composer/installers to add the softcreatr/jsonpath as a library in my Drupal setup:

You are not loading flow/jsonpath using composer and the following modules couldn't be installed: xautoload. Please download these modules or ensure flow/jsonpath is being loaded via your composer setup. [error]

tormi’s picture

https://git.drupalcode.org/project/feeds_ex/-/merge_requests/16 is WIP, but I can now install feeds_ex with composer_manager & softcreatr/jsonpath when using it + hackish patch from 3170173-2:

- https://git.drupalcode.org/project/feeds_ex/-/merge_requests/16.diff
- https://www.drupal.org/files/issues/2020-09-10/3170173-2.patch

I think we should try to reduce the dependency checks & external dependencies defined in feeds_ex.install and replace them with composer_manager.

megachriz’s picture

Status: Active » Needs work

@tormi
How much I like to use one install method and make things simpler, I think we shouldn't do that as that could break people's existing workflows. Not all Drupal 7 sites are using Composer, I would even think a minority of the D7 sites do, though I have no data to back that up. So I think we shouldn't enforce people to use Composer Manager. There are also other methods of using Composer with Drupal 7 so enforcing Composer Manager would possibly create conflicts for these cases.

So I think the required steps are:

  1. Replace occurrences of flow/jsonpath with softcreatr/jsonpath (exists in composer.json, the readme and the .install). Replace the occurrences also in existing update functions, like feeds_ex_update_7102().
  2. Find a way to detect if flow/jsonpath is installed and warn users to replace it with softcreatr/jsonpath (else #3260725: Calling JSONPath::data() is deprecated, please use JSONPath::getData() instead would cause issues for people who only update the module and not the library). I think the warning should be in a new update function in the form of an exception.
luigimannoni’s picture

Just dropping a small note that the 0.7 version is not compatible with php 8

> DrupalProject\composer\ScriptHandler::checkComposerVersion
Installing dependencies from lock file
Verifying lock file contents can be installed on current platform.
Your lock file does not contain a compatible set of packages. Please run composer update.

  Problem 1
    - softcreatr/jsonpath is locked to version 0.7.6 and an update of this package was not requested.
    - softcreatr/jsonpath 0.7.6 requires php >=7.1,<8.0 -> your php version (8.0.25) does not satisfy that requirement.
  Problem 2
    - softcreatr/jsonpath 0.7.6 requires php >=7.1,<8.0 -> your php version (8.0.25) does not satisfy that requirement.
    - drupal/feeds_ex 1.0.0-beta3 requires softcreatr/jsonpath ^0.5 || ^0.7 || ^0.8 -> satisfiable by softcreatr/jsonpath[0.7.6].
    - drupal/feeds_ex is locked to version 1.0.0-beta3 and an update of this package was not requested.

benjifisher made their first commit to this issue’s fork.

benjifisher’s picture

I updated the MR for Comment #9. I am in the process of upgrading my D7 site to PHP 8.

If I have a chance, I will address Comment #8.

P.S. I am using the version constraint recommended at https://github.com/SoftCreatR/JSONPath#installation.

megachriz’s picture

Status: Needs work » Needs review

I've updated the instructions for installing the library. Also included a fix for #3260725: Calling JSONPath::data() is deprecated, please use JSONPath::getData() instead.

I'm also requiring drupal/feeds:^2.0 in composer.json to see if that fixes the "Unable to generate test groups" error.

joelpittet’s picture

This worked like a charm, I'm tempted to commit this and add a release, any objections?

joelpittet’s picture

Status: Needs review » Reviewed & tested by the community

At the least this is RTBC from my standpoint

ceonizm’s picture

Hello,
As the need of migrating to php 8.2 becomes more urgent with the release of Debian 12 and others distributions
Would it be possible to accept this MR and make a new tag in order to allow migrations ?
Thanks in advance

  • MegaChriz committed 8cae9f49 on 7.x-1.x authored by tormi
    Issue #3181865 by tormi, MegaChriz, benjifisher, joelpittet, SoftCreatR...
megachriz’s picture

Status: Reviewed & tested by the community » Fixed

I looked at the code changes again. These look good to me and because others reported that these changes are working, I merged the code!

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

ceonizm’s picture

Hello @MegaChriz,
Would it be possible to do a new release of the module in order to avoid using dev version in our composer.json ?

megachriz’s picture

@ceonizm
I could do that. However, I see there's now also a 0.9.x release of softcreatr/jsonpath. Would it be an issue that a new feeds_ex D7 release is not officially compatible with the latest softcreatr/jsonpath?

megachriz’s picture

According to #3442544: Support version 0.9.x of softcreatr/jsonpath there were no breaking changes in 0.9 other than dropping support for older PHP versions. I shall open a new issue.

megachriz’s picture

megachriz’s picture

Bah! DrupalCI is gone, I have to add GitLab CI support for the D7 version first... #3461771: Add GitLab CI