]> granicus.if.org Git - php/commitdiff
Fixed stream_cast
authorXinchen Hui <laruence@gmail.com>
Wed, 5 Mar 2014 03:28:31 +0000 (11:28 +0800)
committerXinchen Hui <laruence@gmail.com>
Wed, 5 Mar 2014 03:28:31 +0000 (11:28 +0800)
ext/standard/streamsfuncs.c
main/streams/userspace.c

index 1e08f6806f03f312ff32eb1f80de52a395d8aee3..a8ce014a9cb43d32351a2ef3ea8ae96106454daf 100644 (file)
@@ -492,6 +492,7 @@ PHP_FUNCTION(stream_get_meta_data)
        array_init(return_value);
 
        if (!ZVAL_IS_UNDEF(&stream->wrapperdata)) {
+               Z_ADDREF_P(&stream->wrapperdata);
                add_assoc_zval(return_value, "wrapper_data", &stream->wrapperdata);
        }
        if (stream->wrapper) {
@@ -779,7 +780,6 @@ PHP_FUNCTION(stream_select)
        FD_ZERO(&efds);
 
        if (r_array != NULL) {
-               r_array = Z_REFVAL_P(r_array);
                set_count = stream_array_to_fd_set(r_array, &rfds, &max_fd TSRMLS_CC);
                if (set_count > max_set_count)
                        max_set_count = set_count;
@@ -787,7 +787,6 @@ PHP_FUNCTION(stream_select)
        }
 
        if (w_array != NULL) {
-               w_array = Z_REFVAL_P(w_array);
                set_count = stream_array_to_fd_set(w_array, &wfds, &max_fd TSRMLS_CC);
                if (set_count > max_set_count)
                        max_set_count = set_count;
@@ -795,7 +794,6 @@ PHP_FUNCTION(stream_select)
        }
 
        if (e_array != NULL) {
-               e_array = Z_REFVAL_P(e_array);
                set_count = stream_array_to_fd_set(e_array, &efds, &max_fd TSRMLS_CC);
                if (set_count > max_set_count)
                        max_set_count = set_count;
index 459da11770614cfeea11065092846476d528ce9a..a0839bd3fe1e3b9d64a0f55ceffec7c0b9828e2b 100644 (file)
@@ -1510,7 +1510,7 @@ static int php_userstreamop_cast(php_stream *stream, int castas, void **retptr T
                                        us->wrapper->classname);
                        break;
                }
-               if (Z_TYPE(retval) != IS_UNDEF || !zend_is_true(&retval TSRMLS_CC)) {
+               if (ZVAL_IS_UNDEF(&retval) || !zend_is_true(&retval TSRMLS_CC)) {
                        break;
                }
                php_stream_from_zval_no_verify(intstream, &retval);