php - Illegal string offset 'qty' Wordpress -


i have problem illegal string offset 'qty' using wordpress , don't know how fix it.

illegal string offset 'qty' public_html/wp-content/themes/freelancersvalley/includes/aecore/payments.php on line 70

code:

function ae_user_package_info($user_id) {     if (!$user_id) return;     global $ae_post_factory;     $ae_pack = $ae_post_factory->get('pack');     $packs = $ae_pack->fetch();     $orders = ae_payment::get_current_order($user_id);     $package_data = ae_package::get_package_data($user_id);     foreach ($packs $package) {         $sku = $package->sku;         if (isset($package_data[$sku]) && $package_data[$sku]['qty'] > 0) {             if( $package->post_type == 'pack'){                 $order = get_post($orders[$sku]);                 if (!$order || is_wp_error($order) || !in_array($order->post_status, array('publish', 'pending'))) continue;                     /**                     * print text when company has job left in package                     */                     ?>                     <p> 

where mistake?

your error means $package_data[$sku] string , not array (as expecting.

the offset of a in stackoverflow 2 (because s 0 , t 1).

to fix issue, need ensure $package_data[$sku] array , contains key called qty.

i'm not sure if "fix" issue, can avoid error if write: isset($package_data[$sku]['qty']) instead of isset($package_data[$sku])


Comments

Popular posts from this blog

python Tkinter Capturing keyboard events save as one single string -

android - InAppBilling registering BroadcastReceiver in AndroidManifest -

javascript - Z-index in d3.js -