php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #19741 Path no longer works in unlink, pdf_open_file
Submitted: 2002-10-03 14:48 UTC Modified: 2002-10-27 22:12 UTC
Votes:6
Avg. Score:4.8 ± 0.4
Reproduced:6 of 6 (100.0%)
Same Version:3 (50.0%)
Same OS:1 (16.7%)
From: scott at meikohou dot com Assigned:
Status: Closed Package: Apache2 related
PHP Version: 4.2.3 and CVS Snap OS: linux 2.4.18
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: scott at meikohou dot com
New email:
PHP Version: OS:

 

 [2002-10-03 14:48 UTC] scott at meikohou dot com
In old apache 
1.3.26/php.4.0.6


if (file_exists("somefile.pdf")) unlink("somefile.pdf");
pdf_open_file($pdf, "somefile.pdf");

would check the current directory.
ie .. it will do these actions whereever documentroot happens to be.

now it does not do this anymore in Apache/2.0.42 (Unix) mod_ssl/2.0.42 OpenSSL/0.9.6b PHP/4.2.3 

in apache 2.0.42
getcwd() returns the current working directory <documentroot>

however if i do chdir (documentroot)
the first command 
if (file_exists("somefile.pdf")) unlink("somefile.pdf");
will work
but the 2nd
pdf_open_file($pdf, "somefile.pdf");
will not.

the workaround seems to be to work is to include the whole path
pdf_open_file($pdf, "$documentroot/somefile.pdf");

which appears to work .. is this a bug or a feature?


Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-10-03 18:26 UTC] pkmail1 at genion dot de
A smarter variant of the workaround is to use
file_exists(realpath('somefile.pdf'));
which works quite fine on Apache 2.0.40

Philipp
 [2002-10-03 18:39 UTC] scott at meikohou dot com
on further examination it appears only 
pdf_open_file($pdf, "somefile.pdf"); 
does not work and must be substituted with
pdf_open_file($pdf, "$documentroot/somefile.pdf");

(or the smart example) 

i took the liberty of checking with pdf.c and it doesnt appear to be any different.
 [2002-10-03 19:35 UTC] sniper@php.net
Please try using this CVS snapshot:

  http://snaps.php.net/php4-latest.tar.gz
 
For Windows:
 
  http://snaps.php.net/win32/php4-win32-latest.zip
 [2002-10-07 10:44 UTC] brad at brad-x dot com
CVS Snapshot had no impact.
 [2002-10-19 01:00 UTC] php-bugs at lists dot php dot net
No feedback was provided for this bug for over 2 weeks, so it is
being suspended automatically. If you are able to provide the
information that was originally requested, please do so and change
the status of the bug back to "Open".
 [2002-10-21 09:26 UTC] scott at meikohou dot com
Please check
 [2002-10-22 04:43 UTC] boos at atfreepage dot com
Please check it urgently.
 [2002-10-27 22:12 UTC] sterling@php.net
windows issue, not a php issue...
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Wed Feb 05 21:01:34 2025 UTC