]> granicus.if.org Git - php/commitdiff
fix cwd test in php 5.2, now all tests pass in 5.2 on unix
authorGreg Beaver <cellog@php.net>
Wed, 30 Apr 2008 23:06:57 +0000 (23:06 +0000)
committerGreg Beaver <cellog@php.net>
Wed, 30 Apr 2008 23:06:57 +0000 (23:06 +0000)
ext/phar/util.c

index d89de1b1be77a42faab9967e9bf93e1c36f1c4f9..828975281e5113fc14959d29131df0545ff3a56c 100644 (file)
@@ -309,11 +309,20 @@ char *phar_find_in_include_path(char *filename, int filename_len, phar_archive_d
                efree(entry);
                try_len = filename_len;
                test = phar_fix_filepath(estrndup(filename, filename_len), &try_len, 1 TSRMLS_CC);
-               if (zend_hash_exists(&((*pphar)->manifest), test + 1, try_len - 1)) {
-                       spprintf(&ret, 0, "phar://%s%s", arch, test);
-                       efree(arch);
-                       efree(test);
-                       return ret;
+               if (*test == '/') {
+                       if (zend_hash_exists(&((*pphar)->manifest), test + 1, try_len - 1)) {
+                               spprintf(&ret, 0, "phar://%s%s", arch, test);
+                               efree(arch);
+                               efree(test);
+                               return ret;
+                       }
+               } else {
+                       if (zend_hash_exists(&((*pphar)->manifest), test, try_len)) {
+                               spprintf(&ret, 0, "phar://%s/%s", arch, test);
+                               efree(arch);
+                               efree(test);
+                               return ret;
+                       }
                }
                efree(test);
        }