php.net |  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
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: christian at hoffie dot info
New email:
PHP Version: OS:

 

 [2007-09-07 14:39 UTC] christian at hoffie dot info
Description:
------------
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 php.net, no patches.

This change breaks certain Typo3 setups.

[1] http://cvs.php.net/viewcvs.cgi/php-src/sapi/cgi/cgi_main.c?r1=1.267.2.15.2.42&r2=1.267.2.15.2.43&pathrev=PHP_5_2 (Fixed bug #40419 (Trailing Slash in CGI request don't work))

Reproduce code:
---------------
(a web server, lighttpd in this case, is set up at 127.0.0.1:8000; 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
/var/tmp/php/foo
christian@tux /var/tmp/php $ curl http://localhost:8000/bar.php5.2.3
/var/tmp/php

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.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-09-09 10:35 UTC] jani@php.net
Dmitry, you break, you fix. :)
 [2007-09-10 10:56 UTC] dmitry@php.net
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
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.


 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Nov 21 11:01:29 2024 UTC