|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2002-03-20 12:43 UTC] holler at ergo-soft dot com
The DBM-Functions on Windows truncates the values (cuts 1. char)
excamplecode:
<?php
$d = dbmopen('testfile.dbm', 'c');
dbminsert($d, '0', 'Testtext1');
dbminsert($d, '1', 'Testtext2');
dbminsert($d, '2', 'Testtext3');
echo dbmfetch($d, '0') . '<br>';
echo dbmfetch($d, '1') . '<br>';
echo dbmfetch($d, '2') . '<br>';
dbmclose($d);
?>
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 17:00:01 2025 UTC |
The DBM-Functions on Windows truncates the values (cuts 1. char) examplecode: <?php $d = dbmopen('testfile.dbm', 'c'); dbminsert($d, '0', 'Testtext1'); dbminsert($d, '1', 'Testtext2'); dbminsert($d, '2', 'Testtext3'); echo dbmfetch($d, '0') . '<br>'; echo dbmfetch($d, '1') . '<br>'; echo dbmfetch($d, '2') . '<br>'; dbmclose($d); ?>[marcus@zaphod php4-HEAD]$ php -r 'ini_set("magic_quotes_runtime",1);$db=dbmopen("db","n");dbmreplace($db,"7","alpha");var_dump(dbmfetch($db,"7"));dbmclose($db);' string(5) "alpha" My windowsXP reports: string(6) "lpha\0" that means the original length of the windows result is 5 "lpha" plus one zero byte. that implies the fetch function starts reading after 'a' or skips 'a' on windows. the only thing i can think of is fgets() returns the wrong filepointer on windows or read() starts reading at current offset +1. Maybe this is because we are mixing fgets with read perhaps we should use fgets twice.