#19713 [Opn->Bgs]: filemtime reports existing file doesn't
| From: | hholzgra@php.net | Date: | Wed, 02 Oct 2002 12:11:26 +0000 |
| Subject: | #19713 [Opn->Bgs]: filemtime reports existing file doesn't | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-21259@lists.php.net to get a copy of this message | ||
ID: 19713
Updated by: hholzgra@php.net
Reported By: eflammer@oddpost.com
-Status: Open
+Status: Bogus
Bug Type: Filesystem function related
Operating System: Win 2000 Pro
PHP Version: 4CVS-2002-10-02
New Comment:
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php
Thank you for your interest in PHP.
file() doesn't trim of line endings, you have to do that yourself
print filemtime(trim($file))
Previous Comments:
------------------------------------------------------------------------
[2002-10-02 06:56:48] eflammer@oddpost.com
fixed typo in my email address
------------------------------------------------------------------------
[2002-10-02 06:55:56] eflammer@oddpost.com
When using the filemtime() function if i set a var in the script to the
file to be tested it works fine, if i read the exat sme data in from an
outside file it give a stat warning. Note this happens if i use a
relitve or abosulte path.
Below is the code and output to demonstrate:
baseinfo
PHP Version 4.3.0-dev
--------------------------------------------------------------------------------
Test code
--------------------------------------------------------------------------------
<?php
print "<HR>baseinfo<BR>";
print ("PHP Version ".phpversion());
print "<HR>Test code<HR>";
show_source(__FILE__);
print "<HR>Test Case<BR><HR>Using inside var<HR>";
$line2 = 'file=./webcam.jpg';
list ($id2,$value2) = split("=",$line2);
$file_2 = $value2;
print "got setting $value2<BR>";
print filemtime($file_2);
print "<HR>Using read in var<HR>";
$settings = file("./webstat.ini");
$line = $settings[0];
list($id,$value) = split("=",$line);
$file = $value;
print "got setting $value<BR>";
print filemtime($file);
print "<BR>";
?>
--------------------------------------------------------------------------------
Test Case
--------------------------------------------------------------------------------
Using inside var
--------------------------------------------------------------------------------
got setting ./webcam.jpg
1033559117
--------------------------------------------------------------------------------
Using read in var
--------------------------------------------------------------------------------
got setting ./file.txt
Warning: filemtime() [function.filemtime]: Stat failed for ./file.txt
(errno=2 - No such file or directory) in
c:\inetpub\wwwroot\webcam\test_case.php on line 18
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=19713&edit=1