-
Notifications
You must be signed in to change notification settings - Fork 40
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
PHP Fatal error: Cannot redeclare form_options_from_text #3485
Comments
Yep, seeing this here as well. Upgrade from 1.11.3 to 1.11.4 is OK. |
Should you uninstall options element before upgrade? |
Thanks @findlabnet, we should have realized that would happen. A temporary work-around you can do to fix the problem:
The question is: can we do this same thing in |
Looks like we can't simply add an update hook, because the entire |
Yeah, missed this. I was also working on an update to Webform so it could work with core options_element. |
@laryn helpfully made a new release of Options Element that adds core version checking: https://github.com/backdrop-contrib/options_element/releases/tag/1.x-1.0.1 Though I don't think it can disable itself after updating, at least it will keep anyone from turning it on in 1.12 and higher. |
@quicksketch, @serundeputy had mentioned we could put a warning message if Options Element is present after 1.12.x. We can at as well perhaps. |
Perhaps we can also rename the conflicting functions. I don't think they're used for anything else. |
I guess my last idea won't help since @findlabnet does another module require options_element on your site? The only one I can think of is webform_civicrm. I've made an update for webform_civicrm so it doesn't require it anymore. |
@herbdool, I'm fine with current core implementation. Haven't try CiviCRM, so can't add anything. |
@findlabnet I didn't word it well: I'm wondering why you're unable to fully uninstall options_element. Maybe because there's a dependency, but not clear what module. |
@herbdool this was because same named functions have been exists twice: within core directory (just replaced by me from 1.11.3 to 1.12.0 ) and in module "Options element" - no caused dependency, moreover module haven't settings file. |
no PR here yet, bumping milestone. |
Can we add an |
A bit of a more generic question... "back in the days", we used to use
|
I didn't know about that function. I agree it should be added to the list. |
...PR updated. Unfortunately, because of all the reasons I mentioned in my previous comment, we need to do a direct db query to delete the module entry from the database, instead of using "native" functions. I have tested running db update when upgrading from 1.11.x to 1.12.x and confirmed that is removes the contrib module |
I think your PR makes an incorrect assumption. I'll need to look at it later. You can just run
Though maybe Nate means to change status to zero rather than delete entry? |
True. Although we will not be able to notify the user about this change then (the message returned by the update hook). So basically, if we blindly delete without checking if the module exists or not, it will work, but we'd need to decide whether we should a) be providing a message after db update regardless of whether the module existed in the site before or not; or b) to assume that the site admin/owner follows the Backdrop changelog (and not provide any message at all after db update).
Tried that. Does not remove the module from |
I tweaked your PR @klonos. I think tests will pass now. |
The PR looks great. And as options element does not provide any config or settings, there doesn't seem to be anything else left to clean up or migrate. |
I have updated the PR with the following:
|
@klonos the code is full of db_query so it's a good thing to learn. For example, in system.install: I can't tell if your query works or not. I did find this example which doesn't include a null in the fields:
|
@klonos I was drawing from |
It works 😄 ...I have tested it on my local.
If I use I could use aliases, like If used without a specific alias,
...whereas
Both have the same result, so does not really matter. In other words, I can use any of the below, and the end result after
I have updated the PR to use the second variation, since it seems to be the least confusing of the 3.
Yeah, I know. I have seen various implementation of this, and it might make sense if two different messages need to be shown. The simple If Options Element was found: If not found: PS: I have also added a comment with an explanation as to why we are doing the |
@klonos ideally we should put it back to needs review if code changes because who knows, there could be little errors introduced. I checked and it looks ok. |
...sorry, indeed we should. Noted for next time. And thanks 👍 |
Merged backdrop/backdrop#2564 into 1.x and 1.12.x. Great job! Thanks @herbdool and @klonos for the fix. Thanks @findlabnet and @jerry-hudgins for reporting this issue! |
Describe the bug:*
PHP Fatal error: Cannot redeclare form_options_from_text() (previously declared in /DOC_ROOT/core/modules/field/modules/options/options.module:567) in /DOC_ROOT/modules/contrib/options_element/options_element.module on line 173
Workaround:
Disable contrib "Options element" - upgrade going as expected, but module cannot be uninstalled, disabled only.
Expected behavior:
Check if this contrib exists, then disable/uninstall it before going to core upgrade.
Additional information:
PR by @klonos: backdrop/backdrop#2564
The text was updated successfully, but these errors were encountered: