Answers.Body: <p>I had a look at this and it turns out that this is a something that broke in 5.63 and we should be able to fix it for 5.64. <a href="https://lab.civicrm.org/dev/core/-/issues/4453" rel="nofollow noreferrer">Details here</a>.</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-28T02:24:08.653Z
Answers.Text: Yes, it'll be fixed in 5.64:
  https://github.com/civicrm/civicrm-core/pull/26953
Answers.UserDisplayName: Lars SG
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-07-27T04:45:05.233Z
Answers.LastActivityDate: 2023-07-27T04:45:05.233Z
Answers.UserDisplayName: Lars SG
Body: <p>I'm seeing the below error on two different installs. One is running Joomla 4/Civicrm 5.63.2 the other Joomla 3.10/civicrm 5.63.1, both php 8.0. If I change back to php 7.4 the error does not occur on either. It is shown when I edit the Amounts tab of any contribution page that has monetary transactions enabled and php set to 8.0 or 8.1 (I was not using a price set, just setting a few fixed price contribution options on the Amounts tab).</p>
  <p>I'm not able to recreate it on the demo site that is running joomla 4, php8.0, civi 5.61.4.</p>
  <p>I have determined that if the column name in the table civicrm_price_field_value is either blank or null the error is thrown. If I change them all for a particular contribution page to any other value it then works fine. (For example I changed all of one contribution page to item1, item2, ... using mysql access).</p>
  <p>So I thought that perhaps i just had corrupted data. So I then created a new contribution page and then went back to edit the amounts tab - and got the same error again. Looking in the database shows the civicrm_price_field_value table name column to be null for the new rows.</p>
  <p>So I think its one of two things:</p>
  <ul>
  <li>a new install of civicrm uses NOT NULL DEFAULT &quot;somevalue&quot; for the name column of this table? (I doubt it I've looked on an older - but fresh install)</li>
  <li>something changed between 5.61.4 (cividemo version) and 5.63.1 to cause this? Yet looking in the repo doesn't show Amounts.php getting changed?</li>
  </ul>
  <p>I know I have been able to edit contribution pages previously, but I'm not sure exactly when that was. I thought it was very recently but perhaps it was back before I upgraded php to 8.0.</p>
  <p>Sorry for the rambling, heading off on vacation and I wanted to post before I leave.</p>
  <p>UPDATE: I remembered I had an older civicrm install (5.55.2). So I created a contribution page using that. (the name column for civicrm_price_field_value is indeed all null after the creation). Using php8.0 and this older version I'm able to go back and edit the amounts tab of this page. So I am beginning to think that a bug has been introduced sometime after 5.61.4.</p>
  <hr />
  <pre><code>Cannot assign an empty string to a string offset
  .../administrator/components/com_civicrm/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php:239
  234               $defaults['amount_label'] = $priceField['label'];
  235               foreach ($options as $optionId =&gt; $optionValue) {
  236                 $countRow++;
  237                 $defaults['value'][$countRow] = $optionValue['amount'];
  238                 $defaults['label'][$countRow] = $optionValue['label'] ?? NULL;
  239                 $defaults['name'][$countRow] = $optionValue['name'] ?? NULL;
  240                 $defaults['weight'][$countRow] = $optionValue['weight'];
  241 
  242                 $defaults[&quot;price_field_value&quot;][$countRow] = $optionValue['id'];
  243                 if ($optionValue['is_default']) {
  244                   $defaults['default'] = $countRow;-
  </code></pre>
  
Tags: <error><contribution-page><issues>
Title: Error "cannot assign an empty string to string offset" on contribution admin page
ThreadText: # Error "cannot assign an empty string to string offset" on contribution admin page
  
  (Asked by: username_0 on 2023-07-26)
  
  I'm seeing the below error on two different installs. One is running Joomla 4/Civicrm 5.63.2 the other Joomla 3.10/civicrm 5.63.1, both php 8.0. If I change back to php 7.4 the error does not occur on either. It is shown when I edit the Amounts tab of any contribution page that has monetary transactions enabled and php set to 8.0 or 8.1 (I was not using a price set, just setting a few fixed price contribution options on the Amounts tab).
  I'm not able to recreate it on the demo site that is running joomla 4, php8.0, civi 5.61.4.
  I have determined that if the column name in the table civicrm_price_field_value is either blank or null the error is thrown. If I change them all for a particular contribution page to any other value it then works fine. (For example I changed all of one contribution page to item1, item2, ... using mysql access).
  So I thought that perhaps i just had corrupted data. So I then created a new contribution page and then went back to edit the amounts tab - and got the same error again. Looking in the database shows the civicrm_price_field_value table name column to be null for the new rows.
  So I think its one of two things:
  
  a new install of civicrm uses NOT NULL DEFAULT "somevalue" for the name column of this table? (I doubt it I've looked on an older - but fresh install)
  something changed between 5.61.4 (cividemo version) and 5.63.1 to cause this? Yet looking in the repo doesn't show Amounts.php getting changed?
  
  I know I have been able to edit contribution pages previously, but I'm not sure exactly when that was. I thought it was very recently but perhaps it was back before I upgraded php to 8.0.
  Sorry for the rambling, heading off on vacation and I wanted to post before I leave.
  UPDATE: I remembered I had an older civicrm install (5.55.2). So I created a contribution page using that. (the name column for civicrm_price_field_value is indeed all null after the creation). Using php8.0 and this older version I'm able to go back and edit the amounts tab of this page. So I am beginning to think that a bug has been introduced sometime after 5.61.4.
  
  Cannot assign an empty string to a string offset
  .../administrator/components/com_civicrm/civicrm/CRM/Contribute/Form/ContributionPage/Amount.php:239
  234               $defaults['amount_label'] = $priceField['label'];
  235               foreach ($options as $optionId => $optionValue) {
  236                 $countRow++;
  237                 $defaults['value'][$countRow] = $optionValue['amount'];
  238                 $defaults['label'][$countRow] = $optionValue['label'] ?? NULL;
  239                 $defaults['name'][$countRow] = $optionValue['name'] ?? NULL;
  240                 $defaults['weight'][$countRow] = $optionValue['weight'];
  241 
  242                 $defaults["price_field_value"][$countRow] = $optionValue['id'];
  243                 if ($optionValue['is_default']) {
  244                   $defaults['default'] = $countRow;-
  
  **Tags:** error, contribution-page, issues
  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_1 on 2023-07-27. Score: 2
  
  I had a look at this and it turns out that this is a something that broke in 5.63 and we should be able to fix it for 5.64. [Details here](https://lab.civicrm.org/dev/core/-/issues/4453).
  
  > **Comments:**
  > **username_1**: Yes, it'll be fixed in 5.64: https://github.com/civicrm/civicrm-core/pull/26953  
  
  ---
  
  