Skip to content

Commit 13ba537

Browse files
committed
Review comments
1 parent 01c110a commit 13ba537

File tree

1 file changed

+7
-14
lines changed

1 file changed

+7
-14
lines changed

main/streams/userspace.c

Lines changed: 7 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -704,7 +704,6 @@ static int php_userstreamop_flush(php_stream *stream)
704704
zend_result call_result = zend_call_method_if_exists(Z_OBJ(us->object), func_name, &retval, 0, NULL);
705705
zend_string_release_ex(func_name, false);
706706

707-
// TODO: Warn on unimplemented method?
708707
int ret = call_result == SUCCESS && Z_TYPE(retval) != IS_UNDEF && zval_is_true(&retval) ? 0 : -1;
709708

710709
zval_ptr_dtor(&retval);
@@ -851,14 +850,12 @@ static int user_stream_set_check_liveliness(const php_userstream_data_t *us)
851850
php_error_docref(NULL, E_WARNING,
852851
"%s::" USERSTREAM_EOF " is not implemented! Assuming EOF",
853852
ZSTR_VAL(us->wrapper->ce->name));
854-
// TODO: Returning PHP_STREAM_OPTION_RETURN_NOTIMPL means the stream_set_option() returns true...
855853
return PHP_STREAM_OPTION_RETURN_ERR;
856854
}
857855
if (UNEXPECTED(Z_ISUNDEF(retval))) {
858856
return PHP_STREAM_OPTION_RETURN_ERR;
859857
}
860858
if (EXPECTED(Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE)) {
861-
// TODO This seems wrong?
862859
return Z_TYPE(retval) == IS_TRUE ? PHP_STREAM_OPTION_RETURN_ERR : PHP_STREAM_OPTION_RETURN_OK;
863860
} else {
864861
php_error_docref(NULL, E_WARNING,
@@ -907,7 +904,6 @@ static int user_stream_set_locking(const php_userstream_data_t *us, int value)
907904
php_error_docref(NULL, E_WARNING,
908905
"%s::" USERSTREAM_LOCK " is not implemented!",
909906
ZSTR_VAL(us->wrapper->ce->name));
910-
// TODO: Returning PHP_STREAM_OPTION_RETURN_NOTIMPL means the stream_set_option() returns true...
911907
return PHP_STREAM_OPTION_RETURN_ERR;
912908
}
913909
if (UNEXPECTED(Z_ISUNDEF(retval))) {
@@ -916,15 +912,14 @@ static int user_stream_set_locking(const php_userstream_data_t *us, int value)
916912
if (EXPECTED(Z_TYPE(retval) == IS_FALSE || Z_TYPE(retval) == IS_TRUE)) {
917913
// This is somewhat confusing and relies on magic numbers.
918914
return Z_TYPE(retval) == IS_FALSE;
919-
} else {
920-
// TODO: ext/standard/tests/file/userstreams_004.phpt returns null implicitly for function
921-
// Should this warn or not?
922-
//php_error_docref(NULL, E_WARNING,
923-
// "%s::" USERSTREAM_LOCK " value must be of type bool, %s given",
924-
// ZSTR_VAL(us->wrapper->ce->name), zend_zval_value_name(&retval));
925-
zval_ptr_dtor(&retval);
926-
return PHP_STREAM_OPTION_RETURN_ERR;
927915
}
916+
// TODO: ext/standard/tests/file/userstreams_004.phpt returns null implicitly for function
917+
// Should this warn or not? And should this be considered an error?
918+
//php_error_docref(NULL, E_WARNING,
919+
// "%s::" USERSTREAM_LOCK " value must be of type bool, %s given",
920+
// ZSTR_VAL(us->wrapper->ce->name), zend_zval_value_name(&retval));
921+
zval_ptr_dtor(&retval);
922+
return PHP_STREAM_OPTION_RETURN_NOTIMPL;
928923
}
929924

930925
static int user_stream_set_truncation(const php_userstream_data_t *us, int value, void *ptrparam) {
@@ -958,7 +953,6 @@ static int user_stream_set_truncation(const php_userstream_data_t *us, int value
958953
php_error_docref(NULL, E_WARNING,
959954
"%s::" USERSTREAM_TRUNCATE " is not implemented!",
960955
ZSTR_VAL(us->wrapper->ce->name));
961-
// TODO: Returning PHP_STREAM_OPTION_RETURN_NOTIMPL means the stream_set_option() returns true...
962956
return PHP_STREAM_OPTION_RETURN_ERR;
963957
}
964958
if (UNEXPECTED(Z_ISUNDEF(retval))) {
@@ -1003,7 +997,6 @@ static int user_stream_set_option(const php_userstream_data_t *us, int option, i
1003997
php_error_docref(NULL, E_WARNING,
1004998
"%s::" USERSTREAM_SET_OPTION " is not implemented!",
1005999
ZSTR_VAL(us->wrapper->ce->name));
1006-
// TODO: Returning PHP_STREAM_OPTION_RETURN_NOTIMPL means the stream_set_option() returns true...
10071000
return PHP_STREAM_OPTION_RETURN_ERR;
10081001
}
10091002
if (UNEXPECTED(Z_ISUNDEF(retval))) {

0 commit comments

Comments
 (0)