diff options
author | Gustavo André dos Santos Lopes <cataphract@php.net> | 2011-02-18 17:53:26 +0000 |
---|---|---|
committer | Gustavo André dos Santos Lopes <cataphract@php.net> | 2011-02-18 17:53:26 +0000 |
commit | 37593312764da0bc0b6cdcc3b6c3c3fb698b204e (patch) | |
tree | b2c55f20d7e01d1361fb7edf06d3cbedd11ada4d /main/streams/userspace.c | |
parent | 3510be42b79c03ab5b7a6b861d7b5d3a96a53784 (diff) | |
download | php-git-37593312764da0bc0b6cdcc3b6c3c3fb698b204e.tar.gz |
- Changed return value in userspace stream set_option to "not implemented",
instead of failure.
#Currently, there's no way to test this, because the only operations that have
#a default implementation, set_chunk_size and set_read_buffer are either not
#exposed or, in the 2nd case, completely delegated to the user implementation,
#which can only return true/false, not "not implemented" (and not implementing
#the set_option method in the userspace stream results in error).
Diffstat (limited to 'main/streams/userspace.c')
-rw-r--r-- | main/streams/userspace.c | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/main/streams/userspace.c b/main/streams/userspace.c index 7380c535e1..44ee715264 100644 --- a/main/streams/userspace.c +++ b/main/streams/userspace.c @@ -938,7 +938,7 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value zval *retval = NULL; int call_result; php_userstream_data_t *us = (php_userstream_data_t *)stream->abstract; - int ret = -1; + int ret = PHP_STREAM_OPTION_RETURN_NOTIMPL; zval *zvalue = NULL; zval **args[3]; @@ -991,10 +991,11 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value } else if (call_result == FAILURE) { if (value == 0) { /* lock support test (TODO: more check) */ - ret = 0; + ret = PHP_STREAM_OPTION_RETURN_OK; } else { php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_LOCK " is not implemented!", us->wrapper->classname); + ret = PHP_STREAM_OPTION_RETURN_ERR; } } @@ -1093,16 +1094,15 @@ static int php_userstreamop_set_option(php_stream *stream, int option, int value &retval, 3, args, 0, NULL TSRMLS_CC); - do { - if (call_result == FAILURE) { - php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_SET_OPTION " is not implemented!", - us->wrapper->classname); - break; - } - if (retval && zend_is_true(retval)) { - ret = PHP_STREAM_OPTION_RETURN_OK; - } - } while (0); + if (call_result == FAILURE) { + php_error_docref(NULL TSRMLS_CC, E_WARNING, "%s::" USERSTREAM_SET_OPTION " is not implemented!", + us->wrapper->classname); + ret = PHP_STREAM_OPTION_RETURN_ERR; + } else if (retval && zend_is_true(retval)) { + ret = PHP_STREAM_OPTION_RETURN_OK; + } else { + ret = PHP_STREAM_OPTION_RETURN_ERR; + } if (zoption) { zval_ptr_dtor(&zoption); |