Creating default object from empty value through an array

36 views Asked by At

I have read multiple threads here about the matter, although none of the solutions seem to be similar to mine. I would have attempted to fix this myself but unable to find anything similar I don't even know where to begin. Why am I getting this error, and what are the proper steps to resolve it?

function handleRequestsave_details()
    {
        $this->vbulletin->input->clean_array_gpc('p', array('fullname' => TYPE_STR,
            'address_1' => TYPE_STR, 'address_2' => TYPE_STR, 'address_city' => TYPE_STR,
            'address_state' => TYPE_STR, 'address_zip' => TYPE_STR, 'country' => TYPE_STR,
            'phone' => TYPE_STR, 'company' => TYPE_STR));
        if ($this->checkDetailsFields('details', $this->vbphrase['memarea_required_fields']))
        {
            $information = $this->buildInfoArray();
            $this->vbulletin->userinfo['ma_info'] = $information;
            $this->vbulletin->userinfo['usergroupid'] = $usergrpid;
            if ($this->setCustomerNumber($information, $usergrpid))
            {
                $vbulletin->url = 'members.php?' . $vbulletin->session->vars['sessionurl'] . "do=details";
                eval(print_standard_redirect('memarea_saved_details', true, true));
            }
        }
    }

Here are the other functions included in this script, This is not my code it is simply an old product for vBulletin 3.x I am trying to update for my site. this portion throwing the error is when customers enter their billing details to save in their profile.

 function checkDetailsFields($requested, $errormessage)
    {
        if (empty($this->vbulletin->GPC['fullname']) or empty($this->vbulletin->GPC['address_1']) or
            empty($this->vbulletin->GPC['address_city']) or empty($this->vbulletin->GPC['address_zip']) or
            empty($this->vbulletin->GPC['country']) or empty($this->vbulletin->GPC['phone']))
        {
            //$GLOBALS['error'] = $errormessage;
            eval(standard_error($errormessage));
            //$this->handleRequest($requested);
            return false;
        }
        return true;
    }

function buildInfoArray()
    {
        return array('fullname' => $this->vbulletin->GPC['fullname'], 'address_1' => $this->
            vbulletin->GPC['address_1'], 'address_2' => $this->vbulletin->GPC['address_2'],
            'address_city' => $this->vbulletin->GPC['address_city'], 'address_state' => $this->
            vbulletin->GPC['address_state'], 'address_zip' => $this->vbulletin->GPC['address_zip'],
            'country' => $this->vbulletin->GPC['country'], 'phone' => $this->vbulletin->GPC['phone'],
            'company' => $this->vbulletin->GPC['company']);
    }

function setCustomerNumber($ma_info, $usergroup = '', $usevb = true, $userinfo = '')
    {
        if ($usevb == false)
        {
            $this->vbulletin->userinfo = &$userinfo;
        }
        $fcust = $this->fields['custnum'];
        $fpass = $this->fields['mpassword'];
        $finfo = $this->fields['info'];
        $userdm = datamanager_init('User', $this->vbulletin, ERRTYPE_ARRAY);
        $userinfo = fetch_userinfo($this->vbulletin->userinfo['userid']);
        $userdm->set_existing($userinfo);
        if (!$this->vbulletin->userinfo["$fcust"] and !$this->vbulletin->userinfo["$fpass"])
        {
            $rand = rand($this->vbulletin->options['memarea_numstart'], $this->vbulletin->
                options['memarea_numend']);
            $num = $this->vbulletin->options['custnum_prefix'] . substr(md5($rand), 0, $this->
                vbulletin->options['memarea_custnumleng'] - strlen($this->vbulletin->options['custnum_prefix']));
            $userdm->set($fcust, $num);
            $pass = substr(md5(time() . $num . $rand . rand(0, 2000)), 0, $this->vbulletin->
                options['memarea_custnumleng']);
            $userdm->set($fpass, $pass);
            $this->sendCustomerInfo($this->vbulletin->userinfo['userid'], $this->vbulletin->
                userinfo['username'], $this->vbulletin->userinfo['email'], $num, $pass);
        }
        if ($usergroup or $usergroup !== '' or $usergroup !== '0')
        {
            if ($usergroup != $this->vbulletin->userinfo['usergroupid'])
            {
            $ma_info['oldgroup'] = $this->vbulletin->userinfo['usergroupid'];
            $userdm->set('usergroupid', $usergroup);
            }
        }
        if ($ma_info)
        {
            $ma_info = serialize($ma_info);
            $userdm->set($finfo, $ma_info);
        }

        $userdm->pre_save();
        if (count($userdm->errors) == 0)
        {
            $userdm->save();
            return true;
        }
        else
        {
            var_dump($userdm->errors);
            return false;
        }
    }
0

There are 0 answers