php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #12997 "readfile()" does not work fine with 'if' and case clauses
Submitted: 2001-08-28 07:11 UTC Modified: 2001-08-29 03:06 UTC
From: sampsa_lintunen at hotmail dot com? Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.0.4pl1 OS: apache
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: sampsa_lintunen at hotmail dot com?
New email:
PHP Version: OS:

 

 [2001-08-28 07:11 UTC] sampsa_lintunen at hotmail dot com?
I have rather complicated architechture in my php-program (including a kind of programhandler...)
In one php-file I tried to send an pdf-formatted file to the browser by using "readfile" -function. For my huge appointment it did not work well with "if" and "case" clauses. And the most imazing was that exactly same script worked in an other php-file (where the architecture was simplier). 
I give you a simple example how the "bug" behaves
*********
$i=1;
if ($i==1)
  readfile(example.txt);  //and nothing happens
*********
$i=1;
if ($i==1)
  readfile(example.txt);  //this worked well
else
  readfile(example.txt);  //this was just for debugging
*********

As you see, it seems to be no sence at all!!! 
You propably think that I had somethin wrong with my code, but no, I and my work mate debugged this problem a half day and I am sure that this bug was just like I said.
I thought that I could have somethin wrong with the libraries but no error occurs...
The libraries are self made and working well in other programs.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2001-08-28 07:25 UTC] lyric@php.net
You need to put quotes around a literal string like "example.txt", otherwise PHP thinks it's the concatenation of two strings "example" and "txt".
 [2001-08-29 03:04 UTC] sampsa_lintunen at hotmail dot com?
I was not careful when I wrote this "bug" and I forgot the quotes from the example...
As a matter of fact, The name of the file comes as string variable and nothing difference using quotes or no.
I am still very imazing...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed May 07 15:01:31 2025 UTC