Issue Bug Closed

#17535index.php assumes current working directory to be PATH_site

Peter Dinges 08/16/07, 08:01 updated 10/02/18, 12:32

Description

After a recent PHP upgrade from 5.1.2-r3 to 5.2.4_pre200708051230-r2 on Gentoo Linux, the Typo3 frontend suddenly stopped working. After some investigation it turned out that the current working directory used in index.php is no longer the link source directory “PATH_site/”, but the link target “/path/to/typo3_src/”. Therefore, the relative paths used to include libraries via TS, like in my case templavoila, were no longer found.

Attached patch changes the current working directory to PATH_site at the very beginning of index.php. Thus, the assumptions about the CWD are fulfilled again.

It might be that this is a Gentoo specific PHP issue. After all, they seem to use a pre-release. However, clarifying the made assumptions about the CWD does not harm either.

Maybe someone with a test server can check PHP’s beavhiour regarding the CWD of linked files in different versions. Consider the following test setup:
$ mkdir $HTDOCS/bar/
$ echo ‘‘ > $HTDOCS/bar/foo.php
$ ln -s $HTDOCS/bar/foo.php $HTDOCS/foo.php

It seems that the expected and old output of http://host/foo.php is “$HTDOCS”. In my setup however, the output is “$HTDOCS/bar”.

Setup: Apache 2.2.4-r11 with mod_fcgid and PHP 5.2.4_pre200708051230-r2 (FastCGI) on Gentoo Linux.
(issue imported from #M6158)

Reviews 0

No change resolves or names this issue in its commit message, and no comment links one.