Title: [PHP 8.1] Warning: Undefined array key
Last modified: July 14, 2024

---

# [PHP 8.1] Warning: Undefined array key

 *  Resolved [eko](https://wordpress.org/support/users/ekndev/)
 * (@ekndev)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/php-8-1-warning-undefined-array-key-3/)
 * There are PHP 8.1 compatibility issues. Whenever I make a save to the Dynamic
   QR setting, there will be a warning given, as follows:
   `Warning: Undefined array
   key "sos-dynamic-qr-code-mb_post-content-12" in /home/httpd/vhosts/_/httpdocs/
   wordpress/wp-content/plugins/dynamic-qr-code/sos/wp/metabox.php on line 188 Warning:
   Cannot modify header information - headers already sent by (output started at/
   home/httpd/vhosts/_/httpdocs/wordpress/wp-content/plugins/dynamic-qr-code/sos/
   wp/metabox.php:188) in /home/httpd/vhosts/_/httpdocs/wordpress/wp-includes/pluggable.
   php on line 1435 Warning: Cannot modify header information - headers already 
   sent by (output started at /home/httpd/vhosts/_/httpdocs/wordpress/wp-content/
   plugins/dynamic-qr-code/sos/wp/metabox.php:188) in /home/httpd/vhosts/_/httpdocs/
   wordpress/wp-includes/pluggable.php on line 1438`fyi: domain has been substituted
   by _
 * This is also triggering when I do any other request to wp-options.php or post.
   php.
   Please fix it.Let me know if you need any more info.

Viewing 4 replies - 1 through 4 (of 4 total)

 *  Plugin Author [sosidee](https://wordpress.org/support/users/sosidee/)
 * (@sosidee)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/php-8-1-warning-undefined-array-key-3/#post-17889988)
 * Hi,
   I can’t figure out the true reason why this happens without a deeper analysis
   of your configuration, but I believe we can rapidly fix the effect of the problem,
   which is to avoid the warnings.The issue will be definitely fixed in the next
   update, but if you wish to resolve it now the quickest way is to edit a file 
   from the WordPress dashboard just to comment a line (that can be removed without
   compromising the functioning of the plugin).I can give you the info to edit the
   file or, if you prefer, I can do it for you if you create a temporary administrator
   account and send the login data to [support@sosidee.com](https://wordpress.org/support/topic/php-8-1-warning-undefined-array-key-3/support@sosidee.com?output_format=md)
 *  Thread Starter [eko](https://wordpress.org/support/users/ekndev/)
 * (@ekndev)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/php-8-1-warning-undefined-array-key-3/#post-17890999)
 * It is a very basic PHP 8.1 fix:
   In file `dynamic-qr-code/sos/wp/data/field.php`
   Replace line 400 with:`$ret = array_values($result)[0] ?? null;`
 * This fixes the issue.
 *  Plugin Author [sosidee](https://wordpress.org/support/users/sosidee/)
 * (@sosidee)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/php-8-1-warning-undefined-array-key-3/#post-17891081)
 * Very well, thank you for the hint.
 * But, I must admit, I can’t see the link between the line 400 of field.php with
   the line 188 of metabox.php, where $_POST[$nonce_name] is called.
 *  Thread Starter [eko](https://wordpress.org/support/users/ekndev/)
 * (@ekndev)
 * [1 year, 10 months ago](https://wordpress.org/support/topic/php-8-1-warning-undefined-array-key-3/#post-17891934)
 * True, the link is not obvious. So the problem is if you have empty values for
   settings as “Redirect URL for inactive keys”, etc. then you will get above error
   message.
   When you set a value there (all 3 input fields), it will output this
   error:`Warning: Undefined array key 0 in /home/httpd/vhosts/_/httpdocs/wordpress/
   wp-content/plugins/dynamic-qr-code/sos/wp/data/field.php on line 400 Warning:
   Cannot modify header information - headers already sent by (output started at/
   home/httpd/vhosts/_/httpdocs/wordpress/wp-content/plugins/dynamic-qr-code/sos/
   wp/data/field.php:400) in /home/httpd/vhosts/_/httpdocs/wordpress/wp-includes/
   pluggable.php on line 1435 Warning: Cannot modify header information - headers
   already sent by (output started at /home/httpd/vhosts/_/httpdocs/wordpress/wp-
   content/plugins/dynamic-qr-code/sos/wp/data/field.php:400) in /home/httpd/vhosts/_/
   httpdocs/wordpress/wp-includes/pluggable.php on line 1438`
 * Which led me to the solution above.
   Hope it helps.

Viewing 4 replies - 1 through 4 (of 4 total)

The topic ‘[PHP 8.1] Warning: Undefined array key’ is closed to new replies.

 * ![](https://ps.w.org/dynamic-qr-code/assets/icon-256x256.png?rev=2684394)
 * [Dynamic QR Code - generator](https://wordpress.org/plugins/dynamic-qr-code/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/dynamic-qr-code/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/dynamic-qr-code/)
 * [Active Topics](https://wordpress.org/support/plugin/dynamic-qr-code/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/dynamic-qr-code/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/dynamic-qr-code/reviews/)

 * 4 replies
 * 2 participants
 * Last reply from: [eko](https://wordpress.org/support/users/ekndev/)
 * Last activity: [1 year, 10 months ago](https://wordpress.org/support/topic/php-8-1-warning-undefined-array-key-3/#post-17891934)
 * Status: resolved