|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #42587 behaviour change regarding symlinked .php files
Submitted: 2007-09-07 14:39 UTC Modified: 2007-09-10 10:56 UTC
From: christian at hoffie dot info Assigned: dmitry (profile)
Status: Closed Package: CGI/CLI related
PHP Version: 5CVS-2007-09-07 (snap) OS: Linux 2.6
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: christian at hoffie dot info
New email:
PHP Version: OS:


 [2007-09-07 14:39 UTC] christian at hoffie dot info
php-5.2.4 changed the behaviour for the current working directory (cwd) which php scripts see when the requested php file is a symlink which points to a php file in another directory.
It is still reproducible with php5.2-200709071230 (snapshot). php-5.2.3 worked fine. Reverting this commit [1] solves the problem.
I'm using the tarballs from, no patches.

This change breaks certain Typo3 setups.

[1] (Fixed bug #40419 (Trailing Slash in CGI request don't work))

Reproduce code:
(a web server, lighttpd in this case, is set up at; foo.php5.2.3 is handled by php5.2.3, foo.php5.2.5dev by php5.2-200709071230; both binaries have the -n option passed; docroot is /var/tmp/php)

christian@tux /var/tmp/php $ mkdir foo
christian@tux /var/tmp/php $ echo '<?php print getcwd(); ?>' > foo/bar.php
christian@tux /var/tmp/php $ ln -s foo/bar.php bar.php5.2.3
christian@tux /var/tmp/php $ ln -s foo/bar.php bar.php5.2.5dev
christian@tux /var/tmp/php $ curl http://localhost:8000/bar.php5.2.5dev
christian@tux /var/tmp/php $ curl http://localhost:8000/bar.php5.2.3

Expected result:
>=php-5.2.4 should behave exactly as <php-5.2.4; above commands should show "/var/tmp/php" (= the directory of the symlink; not the directory of the target of the symlink).

Actual result:
getcwd() returns /var/tmp/php/foo -- the directory which contains the target of the requested symlink.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-09 10:35 UTC]
Dmitry, you break, you fix. :)
 [2007-09-10 10:56 UTC]
This bug has been fixed in CVS.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
Thank you for the report, and for helping us make PHP better.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Mon Feb 06 23:05:51 2023 UTC