[BUG] php-dbase

Daniel Mróz beorn w alpha.pl
Śro, 9 Kwi 2003, 02:13:11 CEST


Czesc

   Nie dziala modul dbase do PHP:

[beorn w mei blah]$ cat init.php
<?
   $file = 'users.dbf';
   $admin_account = 'admin';
   $admin_password = 'password';
   $hash = 'Foo';
   $name = 'Administrator';
   
   if (! ($dbh = dbase_open($file, 1))) {
      print("Error opening file\n");
      exit(1);
   }

   $password = bin2hex(mhash(MHASH_SHA1, $admin_password, $hash));
   $record = array($admin_account, $password, $name, 1);

   dbase_add_record($dbh, $record);

   dbase_close($dbh);
?>
[beorn w mei blah]$ ls -al init.php users.dbf
-rw-r--r--    1 beorn    users         04-09 01:56 init.php
-rw-r--r--    1 beorn    users         04-09 01:55 users.dbf
[beorn w mei blah]$ dbview -ie users.dbf
File version  : 3
Last update   : 04/09/103
Number of recs: 0
Header length : 161
Record length : 89
Field Name      Type    Length  Decimal Pos
login             C        15       0
pass              C        42       0
name              C        30       0
admin             L         1       0
[beorn w mei blah]$ php init.php
Unable to get header
X-Powered-By: PHP/4.2.3
Content-type: text/html

<br />
<b>Warning</b>:  unable to open database users.dbf in
   <b>/home/users/beorn/public_html/blah/init.php</b> on line
   <b>20</b><br />
Error opening file


Wyciag ze strace:

open("users.dbf", O_WRONLY)             = 4
lseek(4, 0, SEEK_SET)                   = 0
read(4, 0xbfffe1dc, 32)                 = -1 EBADF (Bad file descriptor)
write(2, "Unable to get header\n", 21)  = 21


Plik `users.dbf' byl tworzony funkcja dbase_create().


Pozdrawiam
Beorn

-- 
----------------------------------------------------------------------
Daniel `Beorn' Mróz      <beorn w alpha.pl>       http://127.0.0.1/beorn
GCS/E d-(pu) s-:- a--@ C++++ UL++++$ P+++ L+++ E--- X W+>++ N+++ o? K-
w---  O M- V- PS PE- !Y PGP+ t- 5- R tv-- b+ DI++ D+++ G++ e h! r++ y?
----------------------------------------------------------------------



Więcej informacji o liście dyskusyjnej pld-devel-pl