Skip to content
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

returns weight 0 when weight column name is empty #23874

Conversation

AlainBenbassat
Copy link
Contributor

Overview

During upgrades, some columns may not exist yet, causing CRM_Utils_Weight::getMax() to occasionally fail.

Before

Sometimes $weightField is empty which triggers a DB Error.

After

When $weightField is empty, a weight of zero is returned by CRM_Utils_Weight::getMax() and a warning is logged.

@civibot
Copy link

civibot bot commented Jun 23, 2022

(Standard links)

@civibot civibot bot added the master label Jun 23, 2022
CRM/Utils/Weight.php Outdated Show resolved Hide resolved
@colemanw
Copy link
Member

@AlainBenbassat thanks for this! I think since it solves an existing bug this should be against the 5.51 branch.

@colemanw colemanw changed the base branch from master to 5.51 June 23, 2022 21:31
@civibot civibot bot added 5.51 and removed master labels Jun 23, 2022
@colemanw colemanw force-pushed the empty-weight-column-during-upgrade branch from 1ff77a4 to 22082f9 Compare June 23, 2022 22:13
@colemanw colemanw added the merge ready PR will be merged after a few days if there are no objections label Jun 24, 2022
@colemanw
Copy link
Member

I haven't ever encountered this bug myself during an upgrade, but this change is so safe, I think "why not?"

@eileenmcnaughton eileenmcnaughton merged commit a80402b into civicrm:5.51 Jun 25, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
5.51 merge ready PR will be merged after a few days if there are no objections
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants