Re: include bug in 5.3

From: Date: Mon, 11 Aug 2008 07:31:06 +0000
Subject: Re: include bug in 5.3
References: 1 2 3 4 5 6 7 8 9 10  Groups: php.internals 
Request: Send a blank email to internals+get-39818@lists.php.net to get a copy of this message
Hi Pierre, Thank you for feedback. You are definitely right about FindClose(). The failure of realpath_basic-win32.phpt is expected, as behavior of realpath() became the same as on Linux (slashes after regular file name are not allowed). I wasn't able to reproduce realpath_basic2.phpt failure (may be because I added missing FindClose()). Thanks. Dmitry. Pierre Joye wrote:
hi Dmitry, On Sat, Aug 9, 2008 at 5:28 PM, Dmitry Stogov <dmitry@zend.com> wrote:
The improved patch fixes all the issues I found during testing. However I wasn't able to test it on NETWARE and on Solaris with relative paths. Please test it as much as possible.
I run the test suite and the results can be seen here: http://phpfi.com/341752 There is two failing for real path (Server 2008, Vista 64 and XP (32 and 64)): Test realpath() function: basic functionality [C:\Users\pierre\Documents\php-sdk\vc9\x86\php_5_3\ext\standard\tests\file\realpath_basic-win32.phpt] realpath() with relative directory [C:\Users\pierre\Documents\php-sdk\vc9\x86\php_5_3\ext\standard\tests\file\realpath_basic2.phpt] Some other may fail because of a change in realpath behavior. I will run them again without the patch and post again the affected tests.
I'm going to commit it on Tuesday in case of no objections.
A FindClose is missing:
+#ifdef TSRM_WIN32
+               if (save && (hFind = FindFirstFile(path, &data)) ==  INVALID_HANDLE_VALUE) {
                       if (use_realpath == CWD_REALPATH) {
-                               return 1;
+                               /* file not found */
+                               return -1;
                       }
.....
+               if (save) {
+                       directory = (data.dwFileAttributes &  FILE_ATTRIBUTE_DIRECTORY) != 0;
+                       if (is_dir && !directory) {
+                               /* not a directory */
FindClose(hFind);
+                               return -1;
+                       }
+               }
+               tmp = tsrm_do_alloca(len+1, use_heap);
+               memcpy(tmp, path, len+1);
+#elif defined(NETWARE)
+               save = 0;
+               tmp = tsrm_do_alloca(len+1, use_heap);
+               memcpy(tmp, path, len+1);
#else
Cheers,


« previous php.internals (#39818) next »