php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #30164 touch won't change symbolic links
Submitted: 2004-09-20 10:49 UTC Modified: 2005-02-12 23:29 UTC
From: mave at clanteamtreff dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 5.0.0 OS: Linux ( Debian 3.0 r2 )
Private report: No CVE-ID: None
 [2004-09-20 10:49 UTC] mave at clanteamtreff dot com
Description:
------------
the command

bool touch ( string filename [, int time [, int atime]])

only works with regular files. I have to change some times on Symbolik links. The OS Cmd  touch  can also change times of Symbolik links. Currently i use this, but it issnt really good.

(sorry for my bad english, i hope you understand it)

Reproduce code:
---------------
<?php

// This works
$FileName = "/path/file";
touch($FileName, mktime(0,0,0,1,1,1990) );

// This dont works
$FileName = "/path/link";
touch($FileName, mktime(0,0,0,1,1,1990) );

?> 


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2004-09-20 11:09 UTC] mave at clanteamtreff dot com
Symbolic Links dont work also with the Funktions :

bool chgrp ( string filename, mixed group)
bool chmod ( string filename, int mode
bool chown ( string filename, mixed user)
...
 [2005-02-12 23:29 UTC] tony2001@php.net
No bug in PHP.
That's the way libc's utime() and others work: they change the file, not the link itself.

There are also some syscalls that work with symlinks: lchown, lchmod & lutimes, but as far as I can see they are very system dependant and adding their analogues will probably cause a lot of #ifdef mess.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri May 03 22:01:33 2024 UTC