? ext/standard/tests/file/.include_path_dotdot.phpt.swp Index: main/streams/plain_wrapper.c =================================================================== RCS file: /repository/php-src/main/streams/plain_wrapper.c,v retrieving revision 1.90 diff -u -p -r1.90 plain_wrapper.c --- main/streams/plain_wrapper.c 25 Jul 2007 16:34:27 -0000 1.90 +++ main/streams/plain_wrapper.c 10 Aug 2007 13:03:23 -0000 @@ -1248,16 +1248,7 @@ PHPAPI php_stream *_php_stream_fopen_wit filename_length = strlen(filename); /* Relative path open */ - if (*filename == '.' && (IS_SLASH(filename[1]) || filename[1] == '.')) { - /* further checks, we could have ....... filenames */ - ptr = filename + 1; - if (*ptr == '.') { - while (*(++ptr) == '.'); - if (!IS_SLASH(*ptr)) { /* not a relative path after all */ - goto not_relative_path; - } - } - + if (*filename == '.' && (IS_SLASH(filename[1]) || filename[1] == '.' && IS_SLASH(filename[2]))) { if (((options & STREAM_DISABLE_OPEN_BASEDIR) == 0) && php_check_open_basedir(filename TSRMLS_CC)) { return NULL; Index: ext/standard/tests/file/include_path_dot.phpt =================================================================== RCS file: ext/standard/tests/file/include_path_dot.phpt diff -N ext/standard/tests/file/include_path_dot.phpt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ext/standard/tests/file/include_path_dot.phpt 10 Aug 2007 13:03:24 -0000 @@ -0,0 +1,43 @@ +--TEST-- +include_path with "./" +--FILE-- +'); + +set_include_path(dirname(__FILE__).'/test'); + +// get out +var_dump(chdir(dirname(dirname(__FILE__)))); + +// try to include the file +include './include_path_special.php'; + +var_dump(chdir(dirname(__FILE__).'/test')); +set_include_path(''); + +include './include_path_special.php'; + +// clean env +var_dump(chdir($oldcwd)); + +var_dump(unlink(dirname(__FILE__).'/test/include_path_special.php')); +var_dump(rmdir(dirname(__FILE__).'/test')); +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) + +Warning: include(./include_path_special.php): failed to open stream: No such file or directory in %s/ext/standard/tests/file/include_path_dot.php on line %d + +Warning: include(): Failed opening './include_path_special.php' for inclusion (include_path='%s/ext/standard/tests/file/test') in %s/ext/standard/tests/file/include_path_dot.php on line %d +bool(true) +%s/test/include_path_special.php +bool(true) +bool(true) +bool(true) +===DONE=== Index: ext/standard/tests/file/include_path_dotdot.phpt =================================================================== RCS file: ext/standard/tests/file/include_path_dotdot.phpt diff -N ext/standard/tests/file/include_path_dotdot.phpt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ext/standard/tests/file/include_path_dotdot.phpt 10 Aug 2007 13:03:24 -0000 @@ -0,0 +1,47 @@ +--TEST-- +include_path with "../" +--FILE-- +'); + +set_include_path(dirname(__FILE__).'/test/foo'); + +// get out +var_dump(chdir(dirname(dirname(__FILE__)))); + +// try to include the file +include '../include_path_special.php'; + +var_dump(chdir(dirname(__FILE__).'/test/foo')); +set_include_path(''); + +include '../include_path_special.php'; + +// clean env +var_dump(chdir($oldcwd)); + +var_dump(unlink(dirname(__FILE__).'/test/include_path_special.php')); +var_dump(rmdir(dirname(__FILE__).'/test/foo')); +var_dump(rmdir(dirname(__FILE__).'/test')); +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +bool(true) + +Warning: include(../include_path_special.php): failed to open stream: No such file or directory in %s/ext/standard/tests/file/include_path_dotdot.php on line %d + +Warning: include(): Failed opening '../include_path_special.php' for inclusion (include_path='%s/ext/standard/tests/file/test/foo') in %s/ext/standard/tests/file/include_path_dotdot.php on line %d +bool(true) +%s/test/include_path_special.php +bool(true) +bool(true) +bool(true) +bool(true) +===DONE=== Index: ext/standard/tests/file/include_path_special.phpt =================================================================== RCS file: ext/standard/tests/file/include_path_special.phpt diff -N ext/standard/tests/file/include_path_special.phpt --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ ext/standard/tests/file/include_path_special.phpt 10 Aug 2007 13:03:24 -0000 @@ -0,0 +1,33 @@ +--TEST-- +include_path handling "..." dirs +--FILE-- +'); + +set_include_path(dirname(__FILE__).'/'); + +// get out +var_dump(chdir(dirname(dirname(__FILE__)))); + +// try to include the file +include '.../include_path_special.php'; + +// clean env +var_dump(chdir($oldcwd)); + +var_dump(unlink(dirname(__FILE__).'/.../include_path_special.php')); +var_dump(rmdir(dirname(__FILE__).'/...')); +?> +===DONE=== +--EXPECTF-- +bool(true) +bool(true) +%s/.../include_path_special.php +bool(true) +bool(true) +bool(true) +===DONE===