php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #7642 working directory not maintained in registered shutdown function
Submitted: 2000-11-04 22:46 UTC Modified: 2003-04-21 10:07 UTC
From: kjackson at gpu dot srv dot ualberta dot ca Assigned:
Status: Closed Package: Scripting Engine problem
PHP Version: 4.0.3pl1 OS: Linux
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: kjackson at gpu dot srv dot ualberta dot ca
New email:
PHP Version: OS:

 

 [2000-11-04 22:46 UTC] kjackson at gpu dot srv dot ualberta dot ca
Fox example, the current script is "/dir1/dir2/test.php"...

register_shutdown_function("shutDown");
$cwd = getcwd();
function shutDown()
{
	global $cwd;
	$fp = fopen("/dir1/dir2/temp.txt", "w");
	fwrite($fp, $cwd."\n".getcwd());
	fclose($fp);
}

Run it and view "temp.txt". You will find that the current working directory changes from "/dir1/dir2/" to "/". This was not the case in php 3.0.8, and I presume to be a bug.

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2000-11-05 06:34 UTC] stas@php.net
Failed to reproduce it on current version. Could you please check version at snaps.php.net if this is still happening?
 [2000-11-05 16:15 UTC] kjackson at gpu dot srv dot ualberta dot ca
Yes, it is 4.03pl1.

Here is a link to my sample page with a phpinfo() call as well:

http://www.biology.ualberta.ca/jackson.hp/IWR/_temp.php

One more note, "/dir1" in my case happens to be a nfs mounted filesystem.
 [2000-12-07 12:03 UTC] sniper@php.net
Reopen, if this still happens when using latest snapshot
from http://snaps.php.net/

--Jani
 [2003-05-19 21:32 UTC] usenet0 at malkusch dot de
It seems, that this Bug still exists. 
I'm Using 4.2.3 on Linux. 
And the shutdown function still changes to / 
 
I tested it, by mailing me the CWD in the shutdown function.
 [2012-06-24 15:17 UTC] nat at nath dot is
This is still found in PHP 5.3
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Sep 28 23:01:27 2024 UTC