Bug #62967 [Opn->Ana]: 执行析构函数时工作目录有问题

From: Date: Wed, 29 Aug 2012 14:19:19 +0000
Subject: Bug #62967 [Opn->Ana]: 执行析构函数时工作目录有问题
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-173003@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=62967&edit=1 ID: 62967 Updated by: laruence@php.net Reported by: 360586201 at qq dot com Summary: 执行析构函数时工作目录有问题 -Status: Open +Status: Analyzed Type: Bug Package: *Directory/Filesystem functions PHP Version: 5.3.16 Block user comment: N Private report: N New Comment: __destruct被调用的时候, 当前脚本已经完成了执行, 进入了request shutdown时期, 所以, 此时的工作 目录变成了apache的工作目录. while the __destruct was calling, the script had already be executed, and it has enter the request shutdown phase. so the current work dir became to the apache's . 我大体看了下, 要修复这个, 我们需要花费比较大的改动. 有些昂贵 I'd like mark this as won't fix. Previous Comments: ------------------------------------------------------------------------ [2012-08-29 14:12:53] 360586201 at qq dot com DocumentRoot "D:/www/" ------------------------------------------------------------------------ [2012-08-29 14:09:09] laruence@php.net 你的DocumentRoot设置的是? ------------------------------------------------------------------------ [2012-08-29 13:25:57] 360586201 at qq dot com Description: ------------ 在析构函数的当前工作目录竟然变为了apache目录 更奇怪的是,我不执行普通方法时,析构函数的工作目录是正确的,也是代码的执行目录,当我执行过普 通方法后,就一直为apache目录了 Test script: --------------- <?php class get_path { function __construct() { //获取当前工作路径 echo getcwd().'<br>'; #输出 D:\www\test(代码执行目录) } function write() { //获取当前工作路径 echo getcwd().'<br>'; #输出 D:\www\test(代码执行目录) } function __destruct() { //获取当前工作路径 echo getcwd(); #输出 D:\Program Files\wamp\bin\apache\Apache2.2.21(apache目录) } } $gl = new get_path(); $gl->write(); ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=62967&edit=1

« previous php.bugs (#173003) next »