PHP Bugs  
php.net | support | documentation | report a bug | advanced search | search howto | statistics | login

go to bug id or search bugs for  

Bug #42587 behaviour change regarding symlinked .php files
Submitted:7 Sep 2007 2:39pm UTC Modified: 10 Sep 2007 10:56am UTC
From:christian at hoffie dot info Assigned to:dmitry
Status:Closed Category:CGI related
Version:5CVS-2007-09-07 (snap) OS:Linux 2.6
View/Vote Developer Edit Submission

[7 Sep 2007 2:39pm 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.
[9 Sep 2007 10:35am UTC] jani@php.net
Dmitry, you break, you fix. :)
[10 Sep 2007 10:56am 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.


RSS feed | show source 

PHP Copyright © 2001-2009 The PHP Group
All rights reserved.
Last updated: Sat Nov 21 10:30:49 2009 UTC