php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #47830 getcwd() called during shutdown function returns '/'.
Submitted: 2009-03-29 18:47 UTC Modified: 2009-03-29 19:21 UTC
From: myselfasunder at gmail dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.2.9 OS: Ubuntu
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: myselfasunder at gmail dot com
New email:
PHP Version: OS:

 

 [2009-03-29 18:47 UTC] myselfasunder at gmail dot com
Description:
------------
Running under Apache 2. Error does not occur under the CLI.

Registered a shutdown function (register_shutdown_function()), and while the shutdown function is executing, getcwd() returns '/'.

Reproduce code:
---------------
function shuttingdown()
{

   print(getcwd() . "<br>");
}

register_shutdown_function('shuttingdown');


Expected result:
----------------
The absolute path-name of the current working directory.

Actual result:
--------------
'/' (always, apparently)

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2009-03-29 19:21 UTC] scottmac@php.net
Sorry, but your problem does not imply a bug in PHP itself.  For a
list of more appropriate places to ask for help using PHP, please
visit http://www.php.net/support.php as this bug system is not the
appropriate forum for asking support questions.  Due to the volume
of reports we can not explain in detail here why your report is not
a bug.  The support channels will be able to provide an explanation
for you.

Thank you for your interest in PHP.

From the register_shutdown_function manual page.

"Note: Working directory of the script can change inside the shutdown function under some web servers, e.g. Apache. "
 
PHP Copyright © 2001-2025 The PHP Group
All rights reserved.
Last updated: Thu Jul 10 12:01:33 2025 UTC