]> granicus.if.org Git - php/commitdiff
don't disallow opening .tar/.zip files as Phar object if readonly is disabled, the...
authorGreg Beaver <cellog@php.net>
Sun, 23 Mar 2008 06:59:59 +0000 (06:59 +0000)
committerGreg Beaver <cellog@php.net>
Sun, 23 Mar 2008 06:59:59 +0000 (06:59 +0000)
add crap including an automatic stub or explicit stub

ext/phar/phar.c

index 3fd7278b895240833b1378564c1214f72846fa97..e6c1fca5736c79b0b9e7071e619d277b213b0f83 100644 (file)
@@ -423,7 +423,7 @@ int phar_open_loaded(char *fname, int fname_len, char *alias, int alias_len, int
                if (!is_data) {
                        /* prevent any ".phar" without a stub getting through */
                        if (!phar->halt_offset && !phar->is_brandnew) {
-                               if (FAILURE == zend_hash_find(&(phar->manifest), ".phar/stub.php", sizeof(".phar/stub.php")-1, (void **)&stub)) {
+                               if (PHAR_G(readonly) && FAILURE == zend_hash_find(&(phar->manifest), ".phar/stub.php", sizeof(".phar/stub.php")-1, (void **)&stub)) {
                                        spprintf(error, 0, "'%s' is not a phar archive. Use PharData::__construct() for a standard zip or tar archive", fname);
                                        return FAILURE;
                                }