Title: Type Error
Last modified: August 8, 2025

---

# Type Error

 *  Resolved [Gabor Angyal](https://wordpress.org/support/users/gaborangyal/)
 * (@gaborangyal)
 * [10 months ago](https://wordpress.org/support/topic/type-error-4/)
 * Hi,
   I receive this error:**TypeError**: _Cannot access offset of type array in
   isset or empty_
 *     ```wp-block-code
       <?phpnamespace sgpb;class PopupData{        private static $popupData = array();        private function __construct()        {        }        public static function getPopupDataById($popupId, $saveMode = '')        {                if (!isset(self::$popupData[$popupId])) {                        self::$popupData[$popupId] = SGPopup::getSavedData($popupId, $saveMode);                }                return self::$popupData[$popupId];        }}
       ```
   
 * I can rewrite this code a bit more defensively to prevent the error:
 *     ```wp-block-code
       <?phpnamespace sgpb;class PopupData{        private static $popupData = array();        private function __construct()        {        }        public static function getPopupDataById($popupId, $saveMode = '')        {                if (!is_array(self::$popupData)) {                        self::$popupData = [];                }                if (!is_scalar($popupId) || empty($popupId)) {                        return null;                }                if (!array_key_exists($popupId, self::$popupData)) {                        self::$popupData[$popupId] = SGPopup::getSavedData($popupId, $saveMode);                }                return self::$popupData[$popupId];        }}
       ```
   
 * Could you please also fix this in your codebase?

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

 *  Plugin Support [Jawada](https://wordpress.org/support/users/jawada/)
 * (@jawada)
 * [9 months, 1 week ago](https://wordpress.org/support/topic/type-error-4/#post-18627227)
 * Hi [@gaborangyal](https://wordpress.org/support/users/gaborangyal/)
 * Thank you for bringing this to our attention. We’ve forwarded the details to 
   the appropriate team, and the updated/fixed patch will be included in the next
   version release. We truly appreciate your patience and understanding.
 * Best regards,
 *  Plugin Support [Jawada](https://wordpress.org/support/users/jawada/)
 * (@jawada)
 * [6 months, 2 weeks ago](https://wordpress.org/support/topic/type-error-4/#post-18734937)
 * Hi [@gaborangyal](https://wordpress.org/support/users/gaborangyal/) ,
 * Thank you for your patience and understanding.
 * This issue has now been fixed, and an updated version of Popup Builder has been
   released. Please update to the latest version to apply the fix.
 * If you have any questions, feel free to let us know, we’re here to help.
 * Best regards,

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

The topic ‘Type Error’ is closed to new replies.

 * ![](https://ps.w.org/popup-builder/assets/icon-128x128.gif?rev=2698840)
 * [Popup Builder - Create highly converting, mobile friendly marketing popups.](https://wordpress.org/plugins/popup-builder/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/popup-builder/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/popup-builder/)
 * [Active Topics](https://wordpress.org/support/plugin/popup-builder/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/popup-builder/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/popup-builder/reviews/)

 * 2 replies
 * 2 participants
 * Last reply from: [Jawada](https://wordpress.org/support/users/jawada/)
 * Last activity: [6 months, 2 weeks ago](https://wordpress.org/support/topic/type-error-4/#post-18734937)
 * Status: resolved