Title: PHP8 Error log warning: &#8220;Trying to access array offset on false&#8221;
Last modified: February 25, 2025

---

# PHP8 Error log warning: “Trying to access array offset on false”

 *  [Jer Clarke](https://wordpress.org/support/users/jerclarke/)
 * (@jerclarke)
 * [1 year, 3 months ago](https://wordpress.org/support/topic/php8-error-log-warning-trying-to-access-array-offset-on-false/)
 * Hi! I’m reviewing all my plugins before our big upgrade from PHP 7.3 to PHP 8.3
   and the Donorbox plugin has a small error that causes notices in the logs.
 * Here’s the warning:
 *     ```wp-block-code
       PHP Warning:  Trying to access array offset on false in /Users/jer/Sites/dev.gv/wp-content/plugins/donorbox-donation-form/donorbox_embed_campaign.php on line 128 
       ```
   
 * It’s from this line of code in `donorbox_embed_campaign.php:128` `generate_donorbox_iframe_src()`:
 *     ```wp-block-code
       $options = get_option('donorbox_embed_campaign_options');$donorbox_campaign_input = $options['donorbox_embed_campaign_id']; // get the campaign id
       ```
   
 * The cause is obvious: The code accesses the `$options` assuming that it’s an 
   array, but in this case, it’s false, because I never set up the option (I just
   use the shortcode with the URL in it).
 * The fix is simple and harmless, just check that the array element exists before
   using it:
 *     ```wp-block-code
       $options = get_option('donorbox_embed_campaign_options');$donorbox_campaign_input = '';if (!empty($options['donorbox_embed_campaign_id'])) {        $donorbox_campaign_input = $options['donorbox_embed_campaign_id']; // get the campaign id}
       ```
   
 * Thank you in advance for patching this in the next version 🙏🏻
 * BTW if you have a Github please let me know, I couldn’t find a repository in 
   your account for this WP plugin.
    -  This topic was modified 1 year, 3 months ago by [Jer Clarke](https://wordpress.org/support/users/jerclarke/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [Jer Clarke](https://wordpress.org/support/users/jerclarke/)
 * (@jerclarke)
 * [10 months, 4 weeks ago](https://wordpress.org/support/topic/php8-error-log-warning-trying-to-access-array-offset-on-false/#post-18571544)
 * Bumping so hopefully this doesn’t get closed and force me to write it again. 
   This code has been working fine on my site after the transition.

Viewing 1 replies (of 1 total)

The topic ‘PHP8 Error log warning: “Trying to access array offset on false”’ is 
closed to new replies.

 * ![](https://ps.w.org/donorbox-donation-form/assets/icon-256x256.png?rev=2625882)
 * [Donorbox - Free Recurring Donation Plugin and Fundraising Platform](https://wordpress.org/plugins/donorbox-donation-form/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/donorbox-donation-form/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/donorbox-donation-form/)
 * [Active Topics](https://wordpress.org/support/plugin/donorbox-donation-form/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/donorbox-donation-form/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/donorbox-donation-form/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [Jer Clarke](https://wordpress.org/support/users/jerclarke/)
 * Last activity: [10 months, 4 weeks ago](https://wordpress.org/support/topic/php8-error-log-warning-trying-to-access-array-offset-on-false/#post-18571544)
 * Status: not resolved