Active
Project:
SMS Email Gateway
Version:
6.x-1.0
Component:
Code
Priority:
Normal
Category:
Bug report
Assigned:
Unassigned
Reporter:
Created:
21 Jun 2011 at 14:21 UTC
Updated:
30 Jun 2011 at 22:36 UTC
I get the following warning every time I load a page on my website.
warning: unserialize() expects parameter 1 to be string, array given in unserialize() (line 431 of /public_html/sites/all/modules/smsframework/modules/sms_user/sms_user.module).
After some searching I tried the following code
starting at line 429
$account->sms_user = array();
while ($data = db_fetch_array($result)) {
++ drupal_set_message(dprint_r($account->data, 1));
$user_data = unserialize($account->data);
$account->sms_user = $user_data['sms_user'];
$account->sms_user['number'] = $data['number'];
$account->sms_user['status'] = $data['status'];
$account->sms_user['code'] = $data['code'];
$account->sms_user['gateway'] = unserialize($data['gateway']);
}
and it gave me the information below
Array
(
[contact] => 1
[picture_delete] => 0
[picture_upload] =>
[roles_assign] => Array
(
[3] => 0
[7] => 0
)
[roles_preserve] => Array
(
[2] => 2
[4] => 4
)
[messaging_default] => sms
[notifications_send_interval] => 0
[notifications_auto] => 1
[block] => Array
(
[user] => Array
(
[3] => 0
)
)
[force_password_change] => 0
[sms_user] => Array
(
[number] =>
[status] =>
[gateway] =>
[code] =>
)
)
Since I don't know much about PHP I'm guessing that since the admin account doesn't have any SMS data stored that it is trying to unserialize an empty arrray? If anyone has an good way to fix this please let me know.
Comments
Comment #1
mfbYou'll have to figure out why $account->data is already unserialized. This is not expected. It should be a serialized string, which could be unserialized to an array.
Comment #3
NROTC_Webmaster commentedDo you have any suggestions for how I can find out?
Is it possible just to make it an string again?
Here is one entry from my sms_user table
uid number status code gateway
355 5555555555 2 a:1:{s:7:"carrier";s:23:"messaging.sprintpcs.com";}
So I'm guessing the array it is talking about would be the gateway?
Comment #4
NROTC_Webmaster commentedOk I have been messing with this for days now and if I want to make sure this makes sense.
when I set the it to print the data
I get
which should make sense considering it is exactly how it is stored in the database.
But when I print the account data
I get along with a lot of other data about the account
I just dont understand the difference in specifying the account instead of the specific table its coming from. If anyone can help it out I would really appreciate it.
Comment #5
NROTC_Webmaster commentedmfb
I think you were right in the fact that it was a problem with another area.
If I use
as the last line in the while loop it will print the phone number and carrier information.
I just need to figure out what is causing the error to show up and why the carrier information isn't being passed to the email gateway.
Comment #6
NROTC_Webmaster commentedAfter looking at the sms email gateway I think this belongs in that project.