Answers.Body: <p>Those warnings won't prevent anything from working properly with PHP 8.1, they're just warnings about how future versions of PHP will behave. <a href="https://civicrm.stackexchange.com/questions/43038/civicrm-support-for-php-8-1">See this previous question</a> for settings to avoid having the warnings show up.</p>
  <p>There are a lot of these warnings in PHP 8, but we're slowly cleaning them all up. You can join the effort if you want!</p>
  
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-21T14:27:40.913Z
Answers.Text: Thanks Lars. I've edited both the global and local php.ini files to set error_reporting=E_ALL & ~E_DEPRECATED & ~E_WARNING, but still have the warnings. There must be something else I'm missing, so I'll keep at it.
Answers.UserDisplayName: Brian Downey
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-21T16:00:18.083Z
Answers.Text: You're in production mode and debugging is off?
Answers.UserDisplayName: Lars SG
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-22T14:40:38.757Z
Answers.Text: Yes - Environment set to Production, Enable Debugging selected No.
Answers.UserDisplayName: Brian Downey
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-22T22:48:23.527Z
Answers.Text: You have error_reporting(E_ALL & ~E_DEPRECATED & ~E_WARNING); or error_reporting=E_ALL & ~E_DEPRECATED & ~E_WARNING? Those aren't the same.
Answers.UserDisplayName: Lars SG
Answers.ContentLicense: CC BY-SA 4.0
Answers.CreationDate: 2023-10-20T03:28:57.613Z
Answers.LastActivityDate: 2023-10-20T03:28:57.613Z
Answers.UserDisplayName: Lars SG
Body: <p>We're running CiviCRM 5.66, WordPress 6.3.22, and PHP 8.1.</p>
  <p>We had our hosting service (CiviHosting) upgrade us to CiviCRM 5.66.0 on Sunday. We last upgraded about a year ago. Yesterday (Wednesday) a user noticed our Membership sign-up page (a CiviCRM Contribution page) covered in what appeared to be error messages.</p>
  <p>By way of example, here's a screen capture of the portion of the form asking for First Name;</p>
  <p><a href="https://i.sstatic.net/v6h5z.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/v6h5z.png" alt="screen cap" /></a></p>
  <blockquote>
  <p>Transcription:</p>
  <p>Warning: Undefined array key &quot;options_per_line&quot; in
  /home/antietam/www/dev/wp-content/uploads/civicrm/templates_c/en_US/%%5C/5C2/5C26BC2B%%Fields.tpl.php
  on line 65</p>
  <p>First Name *</p>
  <p>Warning: Undefined array key &quot;is_datetime_field&quot; in
  /home/antietam/www/dev/wp-content/uploads/civicrm/templates_c/en_US/%%5C/5C2/5C26BC2B%%Fields.tpl.php
  on line 110</p>
  <p>Warning: Undefined array key &quot;prefix&quot; in
  /home/antietam/www/dev/wp-content/uploads/civicrm/templates_c/en_US/%%5C/5C2/5C26BC2B%%Fields.tpl.php
  on line 145</p>
  </blockquote>
  <p>After a little research on similar reports on StackExchange, it's clear these are actually PHP Warnings and (probably) do not actually impact the function of the form.</p>
  <p>I could not turn off the errors/warnings by setting error_reporting in the global php.ini file to &quot;Off&quot; but found that reverting PHP to version 7.4 did clear them from the form.</p>
  <p>So now we're running PHP 7.4 on our production site, which seems low risk, but is not sustainable. I recognize we have only masked the problem, not solved it.</p>
  <p>We do not have any other Contribution Pages active on the site at the moment, but will turn one on next week to gather registrations for our next Event. That form also is crawling with these warnings in our Development environment (PHP 8.1), but is clean in production (PHP 7.4).</p>
  <p>I've left our Dev site at PHP 8.1 if you'd like to see the problem our user saw, here:  <a href="https://dev.antietaminstitute.org/become-a-member/" rel="nofollow noreferrer">https://dev.antietaminstitute.org/become-a-member/</a></p>
  <p>My uneducated guess is that there is some code in CivCRM core having to do with Contribution Pages that is incompatible with PHP8, spawning these warnings.</p>
  <p>I do not know enough about the CiviCRM core bug list, but hope this is already on it, or could be added if it is, in fact, a previously unreported bug.</p>
  <p>I'd be very glad for any insight, recommendations, or other feedback, and happy to answer any questions.</p>
  <p>Brian</p>
  
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-10-20T01:40:59.077Z
Comments.Text: Civi works just fine on PHP 8 - so while i don't know what might be triggering the warnings on your site, fundamentally civi is fine with php 8. Have you tried deleting your templates_c folder since it could be that there is some cached stuff in there referencing the older version
Comments.UserDisplayName: petednz - fuzion
Comments.ContentLicense: CC BY-SA 4.0
Comments.CreationDate: 2023-10-21T14:10:59.427Z
Comments.Text: Thanks Petednz; I deleted the templates_c folder, but there was no change. Warnings still appear.
Comments.UserDisplayName: Brian Downey
Tags: <contribution-page><php8>
Title: "Warning: Undefined array key" messages on Membership form after upgrade to CiviCRM 5.66.0
ThreadText: # "Warning: Undefined array key" messages on Membership form after upgrade to CiviCRM 5.66.0
  
  (Asked by: username_0 on 2023-10-19)
  
  We're running CiviCRM 5.66, WordPress 6.3.22, and PHP 8.1.
  
  We had our hosting service (CiviHosting) upgrade us to CiviCRM 5.66.0 on Sunday. We last upgraded about a year ago. Yesterday (Wednesday) a user noticed our Membership sign-up page (a CiviCRM Contribution page) covered in what appeared to be error messages.
  
  By way of example, here's a screen capture of the portion of the form asking for First Name;
  
  [![screen cap](https://i.sstatic.net/v6h5z.png)](https://i.sstatic.net/v6h5z.png)
  
  > Transcription:
  >
  > Warning: Undefined array key "options\_per\_line" in
  > /home/antietam/www/dev/wp-content/uploads/civicrm/templates\_c/en\_US/%%5C/5C2/5C26BC2B%%Fields.tpl.php
  > on line 65
  >
  > First Name \*
  >
  > Warning: Undefined array key "is\_datetime\_field" in
  > /home/antietam/www/dev/wp-content/uploads/civicrm/templates\_c/en\_US/%%5C/5C2/5C26BC2B%%Fields.tpl.php
  > on line 110
  >
  > Warning: Undefined array key "prefix" in
  > /home/antietam/www/dev/wp-content/uploads/civicrm/templates\_c/en\_US/%%5C/5C2/5C26BC2B%%Fields.tpl.php
  > on line 145
  
  After a little research on similar reports on StackExchange, it's clear these are actually PHP Warnings and (probably) do not actually impact the function of the form.
  
  I could not turn off the errors/warnings by setting error\_reporting in the global php.ini file to "Off" but found that reverting PHP to version 7.4 did clear them from the form.
  
  So now we're running PHP 7.4 on our production site, which seems low risk, but is not sustainable. I recognize we have only masked the problem, not solved it.
  
  We do not have any other Contribution Pages active on the site at the moment, but will turn one on next week to gather registrations for our next Event. That form also is crawling with these warnings in our Development environment (PHP 8.1), but is clean in production (PHP 7.4).
  
  I've left our Dev site at PHP 8.1 if you'd like to see the problem our user saw, here: <https://dev.antietaminstitute.org/become-a-member/>
  
  My uneducated guess is that there is some code in CivCRM core having to do with Contribution Pages that is incompatible with PHP8, spawning these warnings.
  
  I do not know enough about the CiviCRM core bug list, but hope this is already on it, or could be added if it is, in fact, a previously unreported bug.
  
  I'd be very glad for any insight, recommendations, or other feedback, and happy to answer any questions.
  
  Brian
  
  **Tags:** contribution-page, php8
  
  > **Comments:**
  > **username_1**: Civi works just fine on PHP 8 - so while i don't know what might be triggering the warnings on your site, fundamentally civi is fine with php 8. Have you tried deleting your templates_c folder since it could be that there is some cached stuff in there referencing the older version  
  > **username_0**: Thanks Petednz; I deleted the templates_c folder, but there was no change. Warnings still appear.  
  
  ---
  
  ## 1 answers
  
  ### Answer by username_2 on 2023-10-20. Score: 2
  
  Those warnings won't prevent anything from working properly with PHP 8.1, they're just warnings about how future versions of PHP will behave. [See this previous question](https://civicrm.stackexchange.com/questions/43038/civicrm-support-for-php-8-1) for settings to avoid having the warnings show up.
  
  There are a lot of these warnings in PHP 8, but we're slowly cleaning them all up. You can join the effort if you want!
  
  > **Comments:**
  > **username_0**: Thanks Lars. I've edited both the global and local php.ini files to set error_reporting=E_ALL & ~E_DEPRECATED & ~E_WARNING, but still have the warnings. There must be something else I'm missing, so I'll keep at it.  
  > **username_2**: You're in production mode and debugging is off?  
  > **username_0**: Yes - Environment set to Production, Enable Debugging selected No.  
  > **username_2**: You have error_reporting(E_ALL & ~E_DEPRECATED & ~E_WARNING); or error_reporting=E_ALL & ~E_DEPRECATED & ~E_WARNING? Those aren't the same.  
  
  ---
  
  