cataphract Fri, 18 Feb 2011 17:53:26 +0000
Revision: http://svn.php.net/viewvc?view=revision&revision=308474
Log:
- 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).
Changed paths:
U php/php-src/trunk/main/streams/userspace.c
Modified: php/php-src/trunk/main/streams/userspace.c
===================================================================
--- php/php-src/trunk/main/streams/userspace.c 2011-02-18 17:22:27 UTC (rev
308473)
+++ php/php-src/trunk/main/streams/userspace.c 2011-02-18 17:53:26 UTC (rev
308474)
@@ -938,7 +938,7 @@
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 @@
} 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 @@
&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);
--
PHP CVS Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php