diff options
Diffstat (limited to 'ext')
-rw-r--r-- | ext/exif/exif.c | 5 | ||||
-rw-r--r-- | ext/pgsql/pgsql.c | 2 | ||||
-rw-r--r-- | ext/standard/exec.c | 6 | ||||
-rw-r--r-- | ext/standard/file.c | 12 | ||||
-rw-r--r-- | ext/standard/fsock.c | 4 | ||||
-rw-r--r-- | ext/standard/image.c | 5 | ||||
-rw-r--r-- | ext/zlib/zlib.c | 10 |
7 files changed, 15 insertions, 29 deletions
diff --git a/ext/exif/exif.c b/ext/exif/exif.c index 7fdf6c9f87..86aab27497 100644 --- a/ext/exif/exif.c +++ b/ext/exif/exif.c @@ -3254,7 +3254,6 @@ PHP_FUNCTION(exif_imagetype) { zval **arg1; php_stream * stream; - int rsrc_id; int itype = 0; if (ZEND_NUM_ARGS() != 1) @@ -3269,11 +3268,9 @@ PHP_FUNCTION(exif_imagetype) RETURN_FALSE; } - rsrc_id = ZEND_REGISTER_RESOURCE(NULL, stream, php_file_le_stream()); - itype = itype = php_getimagetype(stream, NULL TSRMLS_CC); - zend_list_delete(rsrc_id); + php_stream_close(stream); if ( itype == IMAGE_FILETYPE_UNKNOWN) { RETURN_FALSE; diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c index e82379127e..6e870c20b0 100644 --- a/ext/pgsql/pgsql.c +++ b/ext/pgsql/pgsql.c @@ -1478,7 +1478,7 @@ PHP_FUNCTION(pg_trace) php_stream_close(stream); RETURN_FALSE; } - ZEND_REGISTER_RESOURCE(NULL, stream, php_file_le_stream()); + php_stream_auto_cleanup(stream); PQtrace(pgsql, fp); RETURN_TRUE; } diff --git a/ext/standard/exec.c b/ext/standard/exec.c index f5f337fee5..4b6b75c768 100644 --- a/ext/standard/exec.c +++ b/ext/standard/exec.c @@ -49,7 +49,6 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value TSRMLS_DC) int buflen = 0; int t, l, output=1; int overflow_limit, lcmd, ldir; - int rsrc_id; char *b, *c, *d=NULL; php_stream *stream = NULL; #if PHP_SIGCHILD @@ -143,8 +142,6 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value TSRMLS_DC) */ stream = php_stream_fopen_from_pipe(fp, "rb"); - if (stream) - rsrc_id = ZEND_REGISTER_RESOURCE(NULL, stream, php_file_le_stream()); if (type != 3) { l=0; @@ -219,8 +216,7 @@ int php_Exec(int type, char *cmd, pval *array, pval *return_value TSRMLS_DC) } } - /* the zend_list_delete will pclose our popen'ed process */ - zend_list_delete(rsrc_id); + php_stream_close(stream); #if HAVE_SYS_WAIT_H if (WIFEXITED(FG(pclose_ret))) { diff --git a/ext/standard/file.c b/ext/standard/file.c index a58b511902..cf76315f2b 100644 --- a/ext/standard/file.c +++ b/ext/standard/file.c @@ -113,7 +113,7 @@ static void _file_stream_dtor(zend_rsrc_list_entry *rsrc TSRMLS_DC) { php_stream *stream = (php_stream*)rsrc->ptr; /* the stream might be a pipe, so set the return value for pclose */ - FG(pclose_ret) = php_stream_close(stream); + FG(pclose_ret) = php_stream_free(stream, PHP_STREAM_FREE_CLOSE | PHP_STREAM_FREE_RSRC_DTOR); } PHPAPI int php_file_le_stream(void) @@ -528,7 +528,7 @@ PHP_NAMED_FUNCTION(php_if_tmpfile) stream = php_stream_fopen_tmpfile(); if (stream) { - ZEND_REGISTER_RESOURCE(return_value, stream, le_stream); + php_stream_to_zval(stream, return_value); } else { RETURN_FALSE; @@ -593,7 +593,9 @@ PHP_NAMED_FUNCTION(php_if_fopen) RETURN_FALSE; } FG(fgetss_state) = 0; - ZEND_REGISTER_RESOURCE(return_value, stream, le_stream); + + php_stream_to_zval(stream, return_value); + return; } /* }}} */ @@ -676,9 +678,9 @@ PHP_FUNCTION(popen) if (stream == NULL) { zend_error(E_WARNING, "popen(\"%s\", \"%s\"): %s", Z_STRVAL_PP(arg1), p, strerror(errno)); RETVAL_FALSE; + } else { + php_stream_to_zval(stream, return_value); } - else - ZEND_REGISTER_RESOURCE(return_value, stream, le_stream); efree(p); } diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 84a12eb9fc..21eb6e8256 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -141,7 +141,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) (void *) &stream) == SUCCESS) { efree(hashkey); - ZEND_REGISTER_RESOURCE(return_value, stream, php_file_le_stream()); + php_stream_to_zval(stream, return_value); return; } @@ -241,7 +241,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) RETURN_FALSE; } - ZEND_REGISTER_RESOURCE(return_value, stream, php_file_le_stream()); + php_stream_to_zval(stream, return_value); } /* }}} */ diff --git a/ext/standard/image.c b/ext/standard/image.c index 9d6896c608..f12c8cb39e 100644 --- a/ext/standard/image.c +++ b/ext/standard/image.c @@ -684,7 +684,6 @@ PHPAPI int php_getimagetype(php_stream * stream, char *filetype TSRMLS_DC) PHP_FUNCTION(getimagesize) { zval **arg1, **info = NULL; - int rsrc_id; int itype = 0; char temp[64]; struct gfxinfo *result = NULL; @@ -723,8 +722,6 @@ PHP_FUNCTION(getimagesize) RETURN_FALSE; } - rsrc_id = ZEND_REGISTER_RESOURCE(NULL, stream, php_file_le_stream()); - itype = php_getimagetype(stream, NULL TSRMLS_CC); switch( itype) { case IMAGE_FILETYPE_GIF: @@ -763,7 +760,7 @@ PHP_FUNCTION(getimagesize) break; } - zend_list_delete(rsrc_id); + php_stream_close(stream); if (result) { if (array_init(return_value) == FAILURE) { diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c index f4323a8b8b..9c46953f83 100644 --- a/ext/zlib/zlib.c +++ b/ext/zlib/zlib.c @@ -255,15 +255,9 @@ static gzFile php_gzopen_wrapper(char *path, char *mode, int options TSRMLS_DC) stream = php_stream_open_wrapper(path, mode, options | REPORT_ERRORS, NULL); if (stream) { - if (SUCCESS == php_stream_cast(stream, PHP_STREAM_AS_FD|PHP_STREAM_CAST_TRY_HARD, (void**)&fd, 1)) + if (SUCCESS == php_stream_cast(stream, PHP_STREAM_CAST_RELEASE|PHP_STREAM_AS_FD|PHP_STREAM_CAST_TRY_HARD, (void**)&fd, 1)) { - gzFile ret = gzdopen(fd, mode); - if (ret) { - /* arrange to clean up the actual stream */ - ZEND_REGISTER_RESOURCE(NULL, stream, php_file_le_stream()); -/* php_stream_auto_cleanup(stream); */ - return ret; - } + return gzdopen(fd, mode); } php_stream_close(stream); } |