lbarnaud                Mon Aug 11 22:38:17 2008 UTC

  Added files:                 
    /php-src/ext/standard/tests/file    bug45181.phpt 

  Modified files:              
    /php-src/ext/standard       dir.c 
  Log:
  Fixed #45181 (chdir() should clear relative entries in stat cache)
  
  
http://cvs.php.net/viewvc.cgi/php-src/ext/standard/dir.c?r1=1.178&r2=1.179&diff_format=u
Index: php-src/ext/standard/dir.c
diff -u php-src/ext/standard/dir.c:1.178 php-src/ext/standard/dir.c:1.179
--- php-src/ext/standard/dir.c:1.178    Thu Jul 24 12:48:47 2008
+++ php-src/ext/standard/dir.c  Mon Aug 11 22:38:17 2008
@@ -16,7 +16,7 @@
    +----------------------------------------------------------------------+
  */
 
-/* $Id: dir.c,v 1.178 2008/07/24 12:48:47 felipe Exp $ */
+/* $Id: dir.c,v 1.179 2008/08/11 22:38:17 lbarnaud Exp $ */
 
 /* {{{ includes/startup/misc */
 
@@ -26,6 +26,7 @@
 #include "php_dir.h"
 #include "php_string.h"
 #include "php_scandir.h"
+#include "basic_functions.h"
 
 #ifdef HAVE_DIRENT_H
 #include <dirent.h>
@@ -354,6 +355,15 @@
                RETURN_FALSE;
        }
 
+       if (BG(CurrentStatFile) && !IS_ABSOLUTE_PATH(BG(CurrentStatFile), 
strlen(BG(CurrentStatFile)))) {
+               efree(BG(CurrentStatFile));
+               BG(CurrentStatFile) = NULL;
+       }
+       if (BG(CurrentLStatFile) && !IS_ABSOLUTE_PATH(BG(CurrentLStatFile), 
strlen(BG(CurrentLStatFile)))) {
+               efree(BG(CurrentLStatFile));
+               BG(CurrentLStatFile) = NULL;
+       }
+
        RETURN_TRUE;
 }
 /* }}} */

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug45181.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/file/bug45181.phpt
+++ php-src/ext/standard/tests/file/bug45181.phpt
--TEST--
Bug #45181 (chdir() should clear relative entries in stat cache)
--FILE--
<?php
mkdir("bug45181_x");
var_dump(is_dir("bug45181_x"));
chdir("bug45181_x");
var_dump(is_dir("bug45181_x"));
?>
--CLEAN--
<?php
rmdir("bug45181_x");
?>
--EXPECT--
bool(true)
bool(false)



-- 
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to