Skip to content

Commit

Permalink
Merge pull request #6825 from ChurchCRM/fix-custom-field-number
Browse files Browse the repository at this point in the history
[custom field] mb_substr($fieldInfo->name, 1) string must be cast to int to do arithmetic
  • Loading branch information
DAcodedBEAT authored Jan 18, 2024

Verified

This commit was created on GitHub.com and signed with GitHub’s verified signature.
2 parents 29ffcfa + c6da975 commit 0ab2f01
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion src/FamilyCustomFieldsEditor.php
Original file line number Diff line number Diff line change
@@ -136,7 +136,7 @@
// doesn't allow numeric-only field (table column) names.
$fields = mysqli_query($cnInfoCentral, 'SELECT * FROM family_custom');
$fieldInfo = mysqli_fetch_field_direct($fields, $last);
$newFieldNum = mb_substr($fieldInfo->name, 1) + 1;
$newFieldNum = (int) mb_substr($fieldInfo->name, 1) + 1;

// If we're inserting a new custom-list type field,
// create a new list and get its ID
2 changes: 1 addition & 1 deletion src/PersonCustomFieldsEditor.php
Original file line number Diff line number Diff line change
@@ -127,7 +127,7 @@
// The "c#" naming scheme is necessary because MySQL 3.23 doesn't allow numeric-only field (table column) names.
$fields = mysqli_query($cnInfoCentral, 'SELECT * FROM person_custom');
$fieldInfo = mysqli_fetch_field_direct($fields, $last);
$newFieldNum = mb_substr($fieldInfo->name, 1) + 1;
$newFieldNum = (int) mb_substr($fieldInfo->name, 1) + 1;

// If we're inserting a new custom-list type field, create a new list and get its ID
if ($newFieldType == 12) {

0 comments on commit 0ab2f01

Please sign in to comment.