]> granicus.if.org Git - php/commitdiff
- Fix issue with parser error in included phar:// entries
authorMarcus Boerger <helly@php.net>
Fri, 10 Mar 2006 23:52:57 +0000 (23:52 +0000)
committerMarcus Boerger <helly@php.net>
Fri, 10 Mar 2006 23:52:57 +0000 (23:52 +0000)
ext/phar/phar.c

index 61b035d426a0073390b30a16292cf609b2d04246..cbef8ee01fe16a6ec68c6c2b23974ad5e218b3a6 100644 (file)
@@ -910,6 +910,7 @@ static php_stream * php_stream_phar_url_wrapper(php_stream_wrapper *wrapper, cha
        /* do we have the data already? */
        if (idata->fp) {
                fpf = php_stream_alloc(&phar_ops, idata, NULL, mode);
+               idata->phar->refcount++;
                efree(internal_file);
                return fpf;
        }
@@ -1011,6 +1012,7 @@ static php_stream * php_stream_phar_url_wrapper(php_stream_wrapper *wrapper, cha
        idata->internal_file->crc_checked = 1;
 
        fpf = php_stream_alloc(&phar_ops, idata, NULL, mode);
+       idata->phar->refcount++;
        efree(internal_file);
        return fpf;
 }
@@ -1029,6 +1031,9 @@ static int phar_close(php_stream *stream, int close_handle TSRMLS_DC) /* {{{ */
                        data->internal_file->fp = data->fp;
                }
        }
+       if (--data->phar->refcount < 0) {
+               phar_destroy_phar_data(data->phar TSRMLS_CC);
+       }
 
        efree(data);
        return 0;