Bug #9283 Updated: Serialized data gets corrupted in DBM

2002-05-21 Thread php-bugs

 ID:   9283
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Feedback
+Status:   No Feedback
 Bug Type: DBM/DBA related
 Operating System: Windows 98
 PHP Version:  4.0.4pl1
 New Comment:

No feedback was provided for this bug for over a month, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to Open.


Previous Comments:


[2002-04-19 01:21:06] [EMAIL PROTECTED]

can you try again to reproduce this using php4.2.0RC4?

http://www.php.net/~derick/





[2001-02-15 11:53:08] [EMAIL PROTECTED]

I created a set of programs for maintaining userid and password
information using the DBM functions. (dbmopen, dbminsert, etc).. I keep
userid, password, effective date, expiry dates, etc... Hence I need to
keep more than just name  password pairs... I use the userid as the
name and the value is a serialized variable containing an associative
array of the remaining fields... 

My PHP programs to add and display the user records works -
unfortunately it works intermittently... Some time all records are
written correctly and are displayed correctly.. but sometime several
are written but when are displayed, the details of the serialized data
are missing.. it seems to be corrupted...

I attach some code for the dbminsert and dbmfetch here...

Notes: $user is an associative array containing the password, start
dates, etc.

function addUser( $dbName, $dbStatus,  $userid, $user ) {
  $dbh = dbmopen( $dbName, w )
 or die(Couldn't open $dbName database);
  $serial_user = serialize( $user );
  print serial_user is equal to br $serial_user br;
  $dbStatus = dbminsert( $dbh, $userid, $serial_user );
  dbmclose( $dbh );
  }

function getUser( $dbName, $dbStatus, $userid ) {
  $dbh = dbmopen( $dbName, r )  // --- read db 
 or die(Couldn't open $dbName database);
  if ( dbmexists( $dbh, $userid ) )
{
$serial_user = dbmfetch( $dbh, $userid );
print serial_user is equal to br $serial_user br;
$user = unserialize( $serial_user );
}
  else
{ $dbStatus = -1; }
  dbmclose( $dbh );
  return $user;
  }

I looked at the dbm file itself using a text editor and all the data
are present, even for those records that shows blanks for the details.

I opened 2 Internet Explorer windows side by side and ran the insert
program on one and the display on the other. I displayed the serialized
value (i.e. $serial_user) on both windows...

In the add window, the serialized data always looks like this:
a:5:{s:4:name;s:1:a;s:3:pwd ETC ETC...

In the display window, the serialized data also looked as above when
the data is displayed correctly... 

However, when the data is 'missing' the serialized data looks like
this
:5:{s:4:name;s:1:a;s:3:pwd ETC ETC...
(i.e. the 'a' is missing).

(you can see my debugging print statements in the code that I attached
above).

I am running PHP on Apache Web Server (1.3.14) for Windows. Both the
browser client and the Apache server are running on the same PC.

Thanks in advance for your help!







-- 
Edit this bug report at http://bugs.php.net/?id=9283edit=1




Bug #9283 Updated: Serialized data gets corrupted in DBM

2002-04-18 Thread alan_k

 ID:   9283
 Updated by:   [EMAIL PROTECTED]
 Reported By:  [EMAIL PROTECTED]
-Status:   Open
+Status:   Feedback
 Bug Type: DBM/DBA related
 Operating System: Windows 98
 PHP Version:  4.0.4pl1
 New Comment:

can you try again to reproduce this using php4.2.0RC4?

http://www.php.net/~derick/




Previous Comments:


[2001-02-15 11:53:08] [EMAIL PROTECTED]

I created a set of programs for maintaining userid and password
information using the DBM functions. (dbmopen, dbminsert, etc).. I keep
userid, password, effective date, expiry dates, etc... Hence I need to
keep more than just name  password pairs... I use the userid as the
name and the value is a serialized variable containing an associative
array of the remaining fields... 

My PHP programs to add and display the user records works -
unfortunately it works intermittently... Some time all records are
written correctly and are displayed correctly.. but sometime several
are written but when are displayed, the details of the serialized data
are missing.. it seems to be corrupted...

I attach some code for the dbminsert and dbmfetch here...

Notes: $user is an associative array containing the password, start
dates, etc.

function addUser( $dbName, $dbStatus,  $userid, $user ) {
  $dbh = dbmopen( $dbName, w )
 or die(Couldn't open $dbName database);
  $serial_user = serialize( $user );
  print serial_user is equal to br $serial_user br;
  $dbStatus = dbminsert( $dbh, $userid, $serial_user );
  dbmclose( $dbh );
  }

function getUser( $dbName, $dbStatus, $userid ) {
  $dbh = dbmopen( $dbName, r )  // --- read db 
 or die(Couldn't open $dbName database);
  if ( dbmexists( $dbh, $userid ) )
{
$serial_user = dbmfetch( $dbh, $userid );
print serial_user is equal to br $serial_user br;
$user = unserialize( $serial_user );
}
  else
{ $dbStatus = -1; }
  dbmclose( $dbh );
  return $user;
  }

I looked at the dbm file itself using a text editor and all the data
are present, even for those records that shows blanks for the details.

I opened 2 Internet Explorer windows side by side and ran the insert
program on one and the display on the other. I displayed the serialized
value (i.e. $serial_user) on both windows...

In the add window, the serialized data always looks like this:
a:5:{s:4:name;s:1:a;s:3:pwd ETC ETC...

In the display window, the serialized data also looked as above when
the data is displayed correctly... 

However, when the data is 'missing' the serialized data looks like
this
:5:{s:4:name;s:1:a;s:3:pwd ETC ETC...
(i.e. the 'a' is missing).

(you can see my debugging print statements in the code that I attached
above).

I am running PHP on Apache Web Server (1.3.14) for Windows. Both the
browser client and the Apache server are running on the same PC.

Thanks in advance for your help!







-- 
Edit this bug report at http://bugs.php.net/?id=9283edit=1