cvs: TSRM / tsrm_virtual_cwd.c php-src/ext/standard/tests/file realpath_basic4.phpt

"Dmitry Stogov" <[email protected]>
Newsgroups gmane.comp.php.cvs.zend
Message-ID <cvsdmitry1219055280@cvsserver>
dmitry		Mon Aug 18 10:28:00 2008 UTC

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

  Modified files:              
    /TSRM	tsrm_virtual_cwd.c 
  Log:
  Fixed bug #45835 (include and symlinks)
  
  
http://cvs.php.net/viewvc.cgi/TSRM/tsrm_virtual_cwd.c?r1=1.127&r2=1.128&diff_format=u
Index: TSRM/tsrm_virtual_cwd.c
diff -u TSRM/tsrm_virtual_cwd.c:1.127 TSRM/tsrm_virtual_cwd.c:1.128
--- TSRM/tsrm_virtual_cwd.c:1.127	Mon Aug 18 09:32:02 2008
+++ TSRM/tsrm_virtual_cwd.c	Mon Aug 18 10:28:00 2008
@@ -17,7 +17,7 @@
    +----------------------------------------------------------------------+
 */
 
-/* $Id: tsrm_virtual_cwd.c,v 1.127 2008/08/18 09:32:02 dmitry Exp $ */
+/* $Id: tsrm_virtual_cwd.c,v 1.128 2008/08/18 10:28:00 dmitry Exp $ */
 
 #include <sys/types.h>
 #include <sys/stat.h>
@@ -587,6 +587,9 @@
 					/* not a directory */
 					return -1;
 		    	} else {
+		    		if (link_is_dir) {
+		    			*link_is_dir = bucket->is_dir;
+		    		}
 					memcpy(path, bucket->realpath, bucket->realpath_len + 1);
 				    return bucket->realpath_len;
 				}
@@ -656,6 +659,9 @@
 					return -1;
 				}
 			}
+			if (link_is_dir) {
+				*link_is_dir = directory;
+			}
 		} else {
 			if (save) {
 				directory = S_ISDIR(st.st_mode);

http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/realpath_basic4.phpt?view=markup&rev=1.1
Index: php-src/ext/standard/tests/file/realpath_basic4.phpt
+++ php-src/ext/standard/tests/file/realpath_basic4.phpt
--TEST--
Test realpath() with relative paths
--SKIPIF--
<?php
if (substr(PHP_OS, 0, 3) == 'WIN') {
    die('skip no symlinks on Windows');
}
?>
--FILE--
<?php
$file_path = dirname(__FILE__);
@mkdir("$file_path/realpath_basic/home/test", 0777, true);
@symlink("$file_path/realpath_basic/home", "$file_path/realpath_basic/link1");
@symlink("$file_path/realpath_basic/link1", "$file_path/realpath_basic/link2");
echo "1. " . realpath("$file_path/realpath_basic/link2") . "\n";
echo "2. " . realpath("$file_path/realpath_basic/link2/test") . "\n";
?>
--CLEAN--
<?php
$file_path = dirname(__FILE__);
unlink("$file_path/realpath_basic/link2");
unlink("$file_path/realpath_basic/link1");
rmdir("$file_path/realpath_basic/home/test");
rmdir("$file_path/realpath_basic/home");
rmdir("$file_path/realpath_basic");
?>
--EXPECTF--
1. %s%erealpath_basic%ehome
2. %s%erealpath_basic%ehome%etest



-- 
Zend Engine CVS Mailing List (http://cvs.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.