From: [email protected]
Operating system: NetWare
PHP version: 5.2.10
PHP Bug Type: Zip Related
Bug description: compilation broken for NetWare because of wrong ifdefs
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 bug report at http://bugs.php.net/?id=48640&edit=1
--
Try a CVS snapshot (PHP 5.2):
http://bugs.php.net/fix.php?id=48640&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):
http://bugs.php.net/fix.php?id=48640&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):
http://bugs.php.net/fix.php?id=48640&r=trysnapshot60
Fixed in CVS:
http://bugs.php.net/fix.php?id=48640&r=fixedcvs
Fixed in CVS and need be documented:
http://bugs.php.net/fix.php?id=48640&r=needdocs
Fixed in release:
http://bugs.php.net/fix.php?id=48640&r=alreadyfixed
Need backtrace:
http://bugs.php.net/fix.php?id=48640&r=needtrace
Need Reproduce Script:
http://bugs.php.net/fix.php?id=48640&r=needscript
Try newer version:
http://bugs.php.net/fix.php?id=48640&r=oldversion
Not developer issue:
http://bugs.php.net/fix.php?id=48640&r=support
Expected behavior:
http://bugs.php.net/fix.php?id=48640&r=notwrong
Not enough info:
http://bugs.php.net/fix.php?id=48640&r=notenoughinfo
Submitted twice:
http://bugs.php.net/fix.php?id=48640&r=submittedtwice
register_globals:
http://bugs.php.net/fix.php?id=48640&r=globals
PHP 4 support discontinued: http://bugs.php.net/fix.php?id=48640&r=php4
Daylight Savings: http://bugs.php.net/fix.php?id=48640&r=dst
IIS Stability:
http://bugs.php.net/fix.php?id=48640&r=isapi
Install GNU Sed:
http://bugs.php.net/fix.php?id=48640&r=gnused
Floating point limitations:
http://bugs.php.net/fix.php?id=48640&r=float
No Zend Extensions:
http://bugs.php.net/fix.php?id=48640&r=nozend
MySQL Configuration Error:
http://bugs.php.net/fix.php?id=48640&r=mysqlcfg