]> granicus.if.org Git - php/commitdiff
revert last commit to phar_object.c
authorGreg Beaver <cellog@php.net>
Mon, 11 Feb 2008 17:13:18 +0000 (17:13 +0000)
committerGreg Beaver <cellog@php.net>
Mon, 11 Feb 2008 17:13:18 +0000 (17:13 +0000)
fix open file pointers issue on windows

ext/phar/phar.c
ext/phar/phar_object.c

index d2fc3d6d4e26f7bf918d908fa635f6abb1ec9045..c255bdb3b4253998fa24e86ce4a9b9ff8833a289 100644 (file)
@@ -213,6 +213,13 @@ int phar_archive_delref(phar_archive_data *phar TSRMLS_DC) /* {{{ */
                        phar_destroy_phar_data(phar TSRMLS_CC);
                }
                return 1;
+       } else if (!phar->refcount) {
+               if (phar->fp) {
+                       /* close open file handle - allows removal or rename of
+                       the file on windows, which has greedy locking */
+                       php_stream_close(phar->fp);
+                       phar->fp = NULL;
+               }
        }
        return 0;
 }
index 27c95cc4524795e3afe64131857df8c77e7209cb..2493ee154aad176175b8fcbaa9f03e74c6937a56 100755 (executable)
@@ -1172,16 +1172,6 @@ PHP_METHOD(Phar, getSupportedCompression)
                return; \
        }
 
-/* {{{ proto void Phar::__destruct()
- * remove reference count of phar
- */
-PHP_METHOD(Phar, __destruct)
-{
-       PHAR_ARCHIVE_OBJECT();
-
-       phar_archive_delref(phar_obj->arc.archive TSRMLS_CC);
-}
-
 static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ */
 {
        zval **value;
@@ -3449,7 +3439,6 @@ zend_function_entry php_archive_methods[] = {
        PHP_ME(Phar, __construct,           arginfo_phar___construct,  ZEND_ACC_PRIVATE)
 #else
        PHP_ME(Phar, __construct,           arginfo_phar___construct,  ZEND_ACC_PUBLIC)
-       PHP_ME(Phar, __destruct,            NULL,                      ZEND_ACC_PUBLIC)
        PHP_ME(Phar, startBuffering,        NULL,                      ZEND_ACC_PUBLIC)
        PHP_ME(Phar, stopBuffering,         NULL,                      ZEND_ACC_PUBLIC)
        PHP_ME(Phar, compressAllFilesGZ,    NULL,                      ZEND_ACC_PUBLIC)