php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #16190 DBM Support on Windows truncates values
Submitted: 2002-03-20 12:43 UTC Modified: 2002-11-13 09:08 UTC
Votes:3
Avg. Score:4.0 ± 0.8
Reproduced:2 of 2 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (50.0%)
From: holler at ergo-soft dot com Assigned: helly (profile)
Status: Closed Package: DBM/DBA related
PHP Version: 4.3.0-dev OS: Windows
Private report: No CVE-ID: None
 [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);
?>

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-03-20 12:48 UTC] holler at ergo-soft dot com
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);
?>
 [2002-07-06 12:52 UTC] d dot crawford at blueyonder dot co dot uk
Also a problem on Windows 98 and PHP 4.2.0
 [2002-08-05 18:25 UTC] t2315 at freemail dot hu
See my bugreport 18746 for a shorter example.
 [2002-08-12 23:47 UTC] kalowsky@php.net
Dup of 18746... yes I know this came first, but the other one has a shorter example, and a few more comments.
 [2002-08-14 18:00 UTC] sniper@php.net
This bug has been fixed in CVS.

 In case this was a PHP problem, snapshots of the sources are packaged
 every three hours; this change will be in the next snapshot. You can grab
 the snapshot at http://snaps.php.net/.
 
 In case this was a documentation problem, the fix will show up soon at
 http://www.php.net/manual/.

 In case this was a PHP.net website problem, the change will show
 up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.


 [2002-08-17 00:51 UTC] sfox@php.net
okay, we *thought* we'd fixed it ...  sorry ...
 [2002-11-12 22:11 UTC] helly@php.net
[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.
 [2002-11-13 09:08 UTC] helly@php.net
This bug has been fixed in CVS.

In case this was a PHP problem, snapshots of the sources are packaged
every three hours; this change will be in the next snapshot. You can
grab the snapshot at http://snaps.php.net/.
 
In case this was a documentation problem, the fix will show up soon at
http://www.php.net/manual/.

In case this was a PHP.net website problem, the change will show
up on the PHP.net site and on the mirror sites in short time.
 
Thank you for the report, and for helping us make PHP better.

My suggestion turned out to be the solution to this.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 16:01:29 2024 UTC