ID:               48640
 User updated by:  [email protected]
 Reported By:      [email protected]
 Status:           Assigned
 Bug Type:         Zip Related
 Operating System: NetWare
 PHP Version:      5.2.10
 Assigned To:      guenter
 New Comment:

Here's a 'diff -wu php_zip.c.orig php_zip.c' which probably shows
better what the patch really does:
http://www.gknw.net/~gknw/php_zip.c.diff.html


Previous Comments:
------------------------------------------------------------------------

[2009-06-23 13:52:30] [email protected]

Pls commit yourself :)

------------------------------------------------------------------------

[2009-06-23 12:44:09] [email protected]

Ilia, he can commit himself now. Afaics, this patch is only a cleanup
for other platforms, where the #ifdef clauses contain the same code.

------------------------------------------------------------------------

[2009-06-23 12:39:47] [email protected]

Why are the win32 defines being removed in the patch?

------------------------------------------------------------------------

[2009-06-22 10:49:01] [email protected]

Description:
------------
compilation breaks in php_zip.c function php_zip_realpath_r() because
of wrong ifdefs for NetWare which leads to a missing brace.
Although its sufficient to remove the code lines 157-161 I strongly
suggest to cleanup the function code since the rest of ifdefs is very
confusing. Please apply the patch below to a copy of php_zip.c and
compare the result against the current code to verify the patch --
reading the diff properly might be _very_ confusing!

--- php_zip.c.orig      Thu Feb 05 20:53:22 2009
+++ php_zip.c   Fri Mar 27 10:31:02 2009
@@ -148,51 +148,28 @@
                        }
                        return j;
                }
-       
-               path[len] = 0;
 
-#ifdef PHP_WIN32
-               tmp = tsrm_do_alloca(len+1);
-               memcpy(tmp, path, len+1);
-#elif defined(NETWARE)
+               path[len] = 0;
 
                tmp = tsrm_do_alloca(len+1);
                memcpy(tmp, path, len+1);
-#else
-               tmp = tsrm_do_alloca(len+1);
-               memcpy(tmp, path, len+1);
 
-               {
-#endif
-                       if (i - 1 <= start) {
-                               j = start;
-                       } else {
-                               /* some leading directories may be unaccessable 
*/
-                               j = php_zip_realpath_r(path, start, i-1, ll, t, 
use_realpath, 1,
NULL TSRMLS_CC);
-                               if (j > start) {
-                                       path[j++] = DEFAULT_SLASH;
-                               }
+               if (i - 1 <= start) {
+                       j = start;
+               } else {
+                       /* some leading directories may be unaccessable */
+                       j = php_zip_realpath_r(path, start, i-1, ll, t, 
use_realpath, 1,
NULL TSRMLS_CC);
+                       if (j > start) {
+                               path[j++] = DEFAULT_SLASH;
                        }
-#ifdef PHP_WIN32
-                       if (j < 0 || j + len - i >= MAXPATHLEN-1) {
-                               tsrm_free_alloca(tmp);
-
-                               return -1;
-                       }
-                       {
-                               /* use the original file or directory name as 
it wasn't found */
-                               memcpy(path+j, tmp+i, len-i+1);
-                               j += (len-i);
-                       }
-#else
-                       if (j < 0 || j + len - i >= MAXPATHLEN-1) {
-                               tsrm_free_alloca(tmp);
-                               return -1;
-                       }
-                       memcpy(path+j, tmp+i, len-i+1);
-                       j += (len-i);
                }
-#endif
+               if (j < 0 || j + len - i >= MAXPATHLEN-1) {
+                       tsrm_free_alloca(tmp);
+                       return -1;
+               }
+               /* use the original file or directory name as it wasn't found */
+               memcpy(path+j, tmp+i, len-i+1);
+               j += (len-i);
 
                tsrm_free_alloca(tmp);
                return j;




------------------------------------------------------------------------


-- 
Edit this bug report at http://bugs.php.net/?id=48640&edit=1

Reply via email to