Bug #74823 [NEW]: getcwd() incorrect output in register_shutdown_function()

From: Date: Wed, 28 Jun 2017 09:57:56 +0000
Subject: Bug #74823 [NEW]: getcwd() incorrect output in register_shutdown_function()
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-209711@lists.php.net to get a copy of this message
From:             william at jwlchina dot cn
Operating system: ubuntu14.04
PHP version:      7.0.20
Package:          Directory function related
Bug Type:         Bug
Bug description:getcwd() incorrect output in register_shutdown_function()

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 bug report at https://bugs.php.net/bug.php?id=74823&edit=1
-- 
Try a snapshot (PHP 5.4):   https://bugs.php.net/fix.php?id=74823&r=trysnapshot54
Try a snapshot (PHP 5.5):   https://bugs.php.net/fix.php?id=74823&r=trysnapshot55
Try a snapshot (trunk):     https://bugs.php.net/fix.php?id=74823&r=trysnapshottrunk
Fixed in SVN:               https://bugs.php.net/fix.php?id=74823&r=fixed
Fixed in release:           https://bugs.php.net/fix.php?id=74823&r=alreadyfixed
Need backtrace:             https://bugs.php.net/fix.php?id=74823&r=needtrace
Need Reproduce Script:      https://bugs.php.net/fix.php?id=74823&r=needscript
Try newer version:          https://bugs.php.net/fix.php?id=74823&r=oldversion
Not developer issue:        https://bugs.php.net/fix.php?id=74823&r=support
Expected behavior:          https://bugs.php.net/fix.php?id=74823&r=notwrong
Not enough info:            https://bugs.php.net/fix.php?id=74823&r=notenoughinfo
Submitted twice:            https://bugs.php.net/fix.php?id=74823&r=submittedtwice
register_globals:           https://bugs.php.net/fix.php?id=74823&r=globals
PHP 4 support discontinued: https://bugs.php.net/fix.php?id=74823&r=php4
Daylight Savings:           https://bugs.php.net/fix.php?id=74823&r=dst
IIS Stability:              https://bugs.php.net/fix.php?id=74823&r=isapi
Install GNU Sed:            https://bugs.php.net/fix.php?id=74823&r=gnused
Floating point limitations: https://bugs.php.net/fix.php?id=74823&r=float
No Zend Extensions:         https://bugs.php.net/fix.php?id=74823&r=nozend
MySQL Configuration Error:  https://bugs.php.net/fix.php?id=74823&r=mysqlcfg



Thread (2 messages)

« previous php.bugs (#209711) next »