revert last commit to phar_object.c

fix open file pointers issue on windows
This commit is contained in:
Greg Beaver 2008-02-11 17:13:18 +00:00
parent 4c68617106
commit ba002c5b9c
2 changed files with 7 additions and 11 deletions

View File

@ -213,6 +213,13 @@ int phar_archive_delref(phar_archive_data *phar TSRMLS_DC) /* {{{ */
phar_destroy_phar_data(phar TSRMLS_CC); phar_destroy_phar_data(phar TSRMLS_CC);
} }
return 1; 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; return 0;
} }

View File

@ -1172,16 +1172,6 @@ PHP_METHOD(Phar, getSupportedCompression)
return; \ 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) /* {{{ */ static int phar_build(zend_object_iterator *iter, void *puser TSRMLS_DC) /* {{{ */
{ {
zval **value; zval **value;
@ -3449,7 +3439,6 @@ zend_function_entry php_archive_methods[] = {
PHP_ME(Phar, __construct, arginfo_phar___construct, ZEND_ACC_PRIVATE) PHP_ME(Phar, __construct, arginfo_phar___construct, ZEND_ACC_PRIVATE)
#else #else
PHP_ME(Phar, __construct, arginfo_phar___construct, ZEND_ACC_PUBLIC) 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, startBuffering, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phar, stopBuffering, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, stopBuffering, NULL, ZEND_ACC_PUBLIC)
PHP_ME(Phar, compressAllFilesGZ, NULL, ZEND_ACC_PUBLIC) PHP_ME(Phar, compressAllFilesGZ, NULL, ZEND_ACC_PUBLIC)