Bug #74823 [Opn->Nab]: getcwd() incorrect output in register_shutdown_function()

From: Date: Wed, 28 Jun 2017 18:42:59 +0000
Subject: Bug #74823 [Opn->Nab]: getcwd() incorrect output in register_shutdown_function()
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209716@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=74823&edit=1

 ID:                 74823
 Updated by:         requinix@php.net
 Reported by:        william at jwlchina dot cn
 Summary:            getcwd() incorrect output in
                     register_shutdown_function()
-Status:             Open
+Status:             Not a bug
 Type:               Bug
 Package:            Directory function related
 Operating System:   ubuntu14.04
 PHP Version:        7.0.20
 Block user comment: N
 Private report:     N

 New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
http://www.php.net/manual/ and the instructions on how to
report
a bug at http://bugs.php.net/how-to-report.php

http://php.net/manual/en/function.register-shutdown-function.php
> Note:
> Working directory of the script can change inside the shutdown function under
> some web servers, e.g. Apache.


Previous Comments:
------------------------------------------------------------------------
[2017-06-28 09:57:52] william at jwlchina dot cn

Description:
------------
Server: docker ubuntu14.04 
php-fpm version:7.0.15 and 7.0.20
Nginx: 1.4.6

getcwd() incorrect output in register_shutdown_function()

getcwd() returns wrong directory in register_shutdown_function(), only happens when using php-fpm or
cgi. Bug not found in cli mode. 

Test script:
---------------
<?php

echo "Expected:" . getcwd() . "<br>";

register_shutdown_function(function () {
    echo "In shutdown function:" . getcwd() . "<br>";
});


// Output:
// Expected:/var/www/html/test
// In shutdown function:/

Expected result:
----------------
Expected:/var/www/html/test
In shutdown function:/var/www/html/test

Actual result:
--------------
Expected:/var/www/html/test
In shutdown function:/


------------------------------------------------------------------------



--
Edit this bug report at https://bugs.php.net/bug.php?id=74823&edit=1


Thread (2 messages)

« previous php.bugs (#209716) next »