dmitry Tue Nov 13 09:47:19 2007 UTC Modified files: /TSRM tsrm_virtual_cwd.c /php-src/ext/standard/tests/file bug43248.phpt Log: Fixed bug #43248 (backward compatibility break in realpath()) http://cvs.php.net/viewvc.cgi/TSRM/tsrm_virtual_cwd.c?r1=1.116&r2=1.117&diff_format=u Index: TSRM/tsrm_virtual_cwd.c diff -u TSRM/tsrm_virtual_cwd.c:1.116 TSRM/tsrm_virtual_cwd.c:1.117 --- TSRM/tsrm_virtual_cwd.c:1.116 Tue Oct 23 05:57:13 2007 +++ TSRM/tsrm_virtual_cwd.c Tue Nov 13 09:47:19 2007 @@ -17,7 +17,7 @@ +----------------------------------------------------------------------+ */ -/* $Id: tsrm_virtual_cwd.c,v 1.116 2007/10/23 05:57:13 dmitry Exp $ */ +/* $Id: tsrm_virtual_cwd.c,v 1.117 2007/11/13 09:47:19 dmitry Exp $ */ #include <sys/types.h> #include <sys/stat.h> @@ -712,22 +712,25 @@ } ptr = tsrm_strtok_r(NULL, TOKENIZER_STRING, &tok); } -#if defined(TSRM_WIN32) || defined(NETWARE) - if (path[path_length-1] == '\\' || path[path_length-1] == '/') { -#else - if (path[path_length-1] == '/') { -#endif - state->cwd = (char*)realloc(state->cwd, state->cwd_length + 2); - state->cwd[state->cwd_length++] = DEFAULT_SLASH; - state->cwd[state->cwd_length] = 0; - } free(free_path); - if ((use_realpath == CWD_REALPATH) && ret) { - CWD_STATE_FREE(state); - *state = old_state; - return 1; + if (use_realpath == CWD_REALPATH) { + if (ret) { + CWD_STATE_FREE(state); + *state = old_state; + return 1; + } + } else { +#if defined(TSRM_WIN32) || defined(NETWARE) + if (path[path_length-1] == '\\' || path[path_length-1] == '/') { +#else + if (path[path_length-1] == '/') { +#endif + state->cwd = (char*)realloc(state->cwd, state->cwd_length + 2); + state->cwd[state->cwd_length++] = DEFAULT_SLASH; + state->cwd[state->cwd_length] = 0; + } } if (state->cwd_length == COPY_WHEN_ABSOLUTE(state->cwd)) { http://cvs.php.net/viewvc.cgi/php-src/ext/standard/tests/file/bug43248.phpt?r1=1.1&r2=1.2&diff_format=u Index: php-src/ext/standard/tests/file/bug43248.phpt diff -u /dev/null php-src/ext/standard/tests/file/bug43248.phpt:1.2 --- /dev/null Tue Nov 13 09:47:19 2007 +++ php-src/ext/standard/tests/file/bug43248.phpt Tue Nov 13 09:47:19 2007 @@ -0,0 +1,8 @@ +--TEST-- +Bug #43248 backward compatibility break in realpath() +--FILE-- +<?php +echo realpath(dirname(__FILE__) . '/../file/'); +?> +--EXPECTF-- +%sfile
-- PHP CVS Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php