Cannot redeclare conditional_fields_get_simpler_id()

Created on 13 December 2024, 4 months ago

Problem/Motivation

After updating to 4.0.0-alpha6, I have this error :
HP Fatal error: Cannot redeclare conditional_fields_get_simpler_id() (previously declared in /var/www/html/web/modules/contrib/conditional_fields/conditional_fields.module:216) in /var/www/html/web/modules/contrib/conditional_fields/conditional_fields.module on line 260

Steps to reproduce

Updating to 4.0.0-alpha6

Proposed resolution

Need to check code in conditional_fields.module

🐛 Bug report
Status

Active

Version

4.0

Component

Code

Created by

🇫🇷France sébastien-fr Nantes - France

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @sébastien-fr
  • 🇮🇳India mukhtarm

    Hi @sébastien-fr

    Can you please mention from which version you upgraded to 4.0.0-alpha6? 

I followed these steps and couldn't reproduce the issue you stated. 


    1. Installed dev version dev-4.x
    2. Created some conditional fields.
    3. Upgrded to 4.0.0-alpha6 - No errors
    4. Refreshed the conditional fields => Content (Any Type) page - No errors

  • 🇨🇭Switzerland gemisky

    I also see this error message on some of my websites.
    In my case the update was from 4.0.0-alpha5 to 4.0.0-alpha6. I hope this helps.

  • 🇨🇦Canada mregnault

    I had the same issue while updating from 4.0.0-alpha5 to 4.0.0-alpha6. For some reason, the conditional_fields_get_simpler_id() function in the conditional_fields.module file was duplicated, with one small difference, the dot in the end of this line was present in the first declaration of the function and not the second:

    // preg_match('/.*([-]{2,}[a-zA-Z0-9]+)$/', $id, $matches);.
    

    I checked and the code in the repo is fine, the function is only here once. So that's a bit weird. What I did to fix the issue was deleting the conditional_fields directory in my contrib modules and run composer install again.

  • 🇫🇷France sébastien-fr Nantes - France

    @m

    I upgraded from 4.0.0-alpha5 => 4.0.0-alpha6.

    I tested again today and I still have this error. However, I did the update on another site and no problem.

  • 🇨🇦Canada mregnault

    I found what was causing the issue for me. I had this patch applied and updating the module while still having this patch in my composer.json messed things up. Hope this helps! And thanks @garphy for the hint.

  • @mregnault

    Same here. I had this patch in composer.json. After remove everything is ok.

Production build 0.71.5 2024