php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #443 Unable to operate on dBase and standard file simultaneously.
Submitted: 1998-06-07 19:08 UTC Modified: 1998-10-10 19:22 UTC
Votes:1
Avg. Score:3.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:1 (100.0%)
Same OS:1 (100.0%)
From: rgreene at pcpros dot net Assigned:
Status: Closed Package: dBase related
PHP Version: 3.0 Final Release OS: RH Linux 4.2 (2.0.30 kernel)
Private report: No CVE-ID: None
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: rgreene at pcpros dot net
New email:
PHP Version: OS:

 

 [1998-06-07 19:08 UTC] rgreene at pcpros dot net
Apparantly, the dBase and regular file functions are colliding on the file identifier assigned? 
$db is the dBase file id where $FILE is the file id.

Comment out the dbase_open line and all is well.

---OUTPUT---
db=1
<br>
<b>Warning</b>:  Unable to find file identifier 1 in <b>./asd</b> on line <b>7</
b><br>
FILE=1
---ENDOUTPUT---

---SCRIPT---
#!/usr/local/bin/php -q
<?
    $db= dbase_open("master.dbf", 0) ||
                die("Couldn't open dBase file: $filename\n");
    printf("db=$db\n");
    $FILE= fopen("junkfile", "w") || die("Could not create junkfile.\n");
    fwrite($FILE, "hi\n");
    printf("FILE=$FILE\n");
    exit;
?>
---ENDSCRIPT---

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-10-10 19:22 UTC] jim
This is a tricky one -- the result of the || operator is always a boolean value. This means
that:
    $test = "foo" || 5;
results in $test == 1.

In your example, this means that $db and $FILE are getting set to 1, not the return values of
the fopen() and dbase_open() functions.

 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 11:01:31 2025 UTC