You are not logged in... [Login/Register]
Raking Winds >> Bug Reporting >> (FIXED) Database Miswrites

Posts: 1419
Group: Admin
Joined: 08-02-06
Thu - Jun 21, '07 @ 13:47:23
Mental note to self:

Seems to be common with the sessions load/unload. Strongly believed to be caused by the new db_batchedit() function when there are no extries existing when written to it.

Example instance:
<?$session['<removed key>']=array (0=>1182433487.65,1=>'chozo4','a'=>'qzz7M1BAAC9QEc','mc'=>4);
$session['<removed key>']=array (0=>1182433487.65,1=>'chozo4','a'=>'qzz7M1BAAC9QEc','mc'=>4);

One of the lines are ending up on the very first line and as such being permanently existing due to not 'being found' by db_edit() nor db_batchedit() as the entry MUST begin at the start of a line and not after anything else.

Additionally, an odd instance of the bottom php delimiter ending up missing...
$session['<removed key>']=array (0=>1182433487.65,1=>'chozo4','a'=>'qzz7M1BAAC9QEc','mc'=>4);

Found why and awaiting fix...

How to cause it:

include '../config.php';
include '../func_db.php';
echo '<pre>',htmlspecialchars(file_get_contents('db/temp.php')),'<hr>';

// Up to this point there are no entries as expected
// but the bottom delimiter is now missing, however...
// db_edit doesn't like a missing delimiter -.-'
// so caused the line to end up on the first alongside
// the beginning delimiter and then restores the end delim.

//restore to fresh slate after displaying end result.
echo htmlspecialchars(file_get_contents('db/temp.php')),'</pre>';

Had forgotten to collect the rest of the file in for writing back when the index of vars to be edited had been completed early. The bolde line is the one that had been missing:
  for($idx=$vn=$o;$idx && $fg=fgets($fh);$fp=ftell($fh))
    foreach($idx as $k=>$v) {if(strpos($fg,$k)===0) $o[$r=$k]=$fg;}
    if(isset($r)) unset($idx[$k],$r); else $fb.=$fg;
  } $fb.=fread($fh,filesize($wp)); fclose($fh);

Edited by chozo4 on Jun/22/07 @ 23:05:59

Forum Board Development Project (PortaBoard) v0.33
MechWarrior Resource Depot / ChoTek © 2006-2018

Execution Time 0.59927  |  GZip: Off  | 

Powered by ChoTek FlatFile DBv2Powered by PHP 4+ Valid HTML 4.01 Transitional