Skip to content

Fix expression warnings and break warnings #5675

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
wants to merge 1 commit into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -2154,7 +2154,7 @@ ZEND_API int zend_register_functions(zend_class_entry *scope, const zend_functio
scope->ce_flags |= ZEND_ACC_EXPLICIT_ABSTRACT_CLASS;
}
}
if (ptr->flags & ZEND_ACC_STATIC && (!scope || !(scope->ce_flags & ZEND_ACC_INTERFACE))) {
if ((ptr->flags & ZEND_ACC_STATIC) && (!scope || !(scope->ce_flags & ZEND_ACC_INTERFACE))) {
zend_error(error_type, "Static function %s%s%s() cannot be abstract", scope ? ZSTR_VAL(scope->name) : "", scope ? "::" : "", ptr->fname);
}
} else {
Expand Down Expand Up @@ -2992,7 +2992,7 @@ static zend_always_inline int zend_is_callable_check_func(int check_flags, zval
if (zv != NULL) {
zend_function *priv_fbc = Z_PTR_P(zv);

if (priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE
if ((priv_fbc->common.fn_flags & ZEND_ACC_PRIVATE)
&& priv_fbc->common.scope == scope) {
fcc->function_handler = priv_fbc;
}
Expand Down Expand Up @@ -3096,7 +3096,7 @@ static zend_always_inline int zend_is_callable_check_func(int check_flags, zval
if (fcc->object) {
fcc->called_scope = fcc->object->ce;
if (fcc->function_handler
&& fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC) {
&& (fcc->function_handler->common.fn_flags & ZEND_ACC_STATIC)) {
fcc->object = NULL;
}
}
Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_closures.c
Original file line number Diff line number Diff line change
Expand Up @@ -181,7 +181,7 @@ ZEND_METHOD(Closure, call)
/* copied upon generator creation */
GC_DELREF(&closure->std);
} else if (ZEND_USER_CODE(my_function.type)
&& fci_cache.function_handler->common.fn_flags & ZEND_ACC_HEAP_RT_CACHE) {
&& (fci_cache.function_handler->common.fn_flags & ZEND_ACC_HEAP_RT_CACHE)) {
efree(ZEND_MAP_PTR(my_function.op_array.run_time_cache));
}
}
Expand Down
8 changes: 4 additions & 4 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -2333,7 +2333,7 @@ void zend_emit_final_return(int return_one) /* {{{ */
zend_op *ret;
zend_bool returns_reference = (CG(active_op_array)->fn_flags & ZEND_ACC_RETURN_REFERENCE) != 0;

if (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE
if ((CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE)
&& !(CG(active_op_array)->fn_flags & ZEND_ACC_GENERATOR)) {
zend_emit_return_type_check(NULL, CG(active_op_array)->arg_info - 1, 1);
}
Expand Down Expand Up @@ -4516,7 +4516,7 @@ void zend_compile_return(zend_ast *ast) /* {{{ */
}

/* Generator return types are handled separately */
if (!is_generator && CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE) {
if (!is_generator && (CG(active_op_array)->fn_flags & ZEND_ACC_HAS_RETURN_TYPE)) {
zend_emit_return_type_check(
expr_ast ? &expr_node : NULL, CG(active_op_array)->arg_info - 1, 0);
}
Expand Down Expand Up @@ -5492,7 +5492,7 @@ ZEND_API void zend_set_function_arg_flags(zend_function *func) /* {{{ */
ZEND_SET_ARG_FLAG(func, i + 1, ZEND_ARG_SEND_MODE(&func->common.arg_info[i]));
i++;
}
if (UNEXPECTED(func->common.fn_flags & ZEND_ACC_VARIADIC && ZEND_ARG_SEND_MODE(&func->common.arg_info[i]))) {
if (UNEXPECTED((func->common.fn_flags & ZEND_ACC_VARIADIC) && ZEND_ARG_SEND_MODE(&func->common.arg_info[i]))) {
uint32_t pass_by_reference = ZEND_ARG_SEND_MODE(&func->common.arg_info[i]);
while (i < MAX_ARG_FLAG_NUM) {
ZEND_SET_ARG_FLAG(func, i + 1, pass_by_reference);
Expand Down Expand Up @@ -9339,7 +9339,7 @@ void zend_eval_const_expr(zend_ast **ast_ptr) /* {{{ */
}

/* Set isset fetch indicator here, opcache disallows runtime altering of the AST */
if (ast->attr & ZEND_DIM_IS && ast->child[0]->kind == ZEND_AST_DIM) {
if ((ast->attr & ZEND_DIM_IS) && ast->child[0]->kind == ZEND_AST_DIM) {
ast->child[0]->attr |= ZEND_DIM_IS;
}

Expand Down
2 changes: 1 addition & 1 deletion Zend/zend_object_handlers.c
Original file line number Diff line number Diff line change
Expand Up @@ -1156,7 +1156,7 @@ static zend_never_inline zend_function *zend_get_parent_private_method(zend_clas
func = zend_hash_find(&scope->function_table, function_name);
if (func != NULL) {
fbc = Z_FUNC_P(func);
if (fbc->common.fn_flags & ZEND_ACC_PRIVATE
if ((fbc->common.fn_flags & ZEND_ACC_PRIVATE)
&& fbc->common.scope == scope) {
return fbc;
}
Expand Down
22 changes: 11 additions & 11 deletions ext/date/php_date.c
Original file line number Diff line number Diff line change
Expand Up @@ -4374,17 +4374,17 @@ PHP_METHOD(DatePeriod, getRecurrences)

static int check_id_allowed(char *id, zend_long what) /* {{{ */
{
if (what & PHP_DATE_TIMEZONE_GROUP_AFRICA && strncasecmp(id, "Africa/", 7) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_AMERICA && strncasecmp(id, "America/", 8) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_ANTARCTICA && strncasecmp(id, "Antarctica/", 11) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_ARCTIC && strncasecmp(id, "Arctic/", 7) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_ASIA && strncasecmp(id, "Asia/", 5) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_ATLANTIC && strncasecmp(id, "Atlantic/", 9) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_AUSTRALIA && strncasecmp(id, "Australia/", 10) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_EUROPE && strncasecmp(id, "Europe/", 7) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_INDIAN && strncasecmp(id, "Indian/", 7) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_PACIFIC && strncasecmp(id, "Pacific/", 8) == 0) return 1;
if (what & PHP_DATE_TIMEZONE_GROUP_UTC && strncasecmp(id, "UTC", 3) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_AFRICA) && strncasecmp(id, "Africa/", 7) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_AMERICA) && strncasecmp(id, "America/", 8) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_ANTARCTICA) && strncasecmp(id, "Antarctica/", 11) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_ARCTIC) && strncasecmp(id, "Arctic/", 7) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_ASIA) && strncasecmp(id, "Asia/", 5) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_ATLANTIC) && strncasecmp(id, "Atlantic/", 9) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_AUSTRALIA) && strncasecmp(id, "Australia/", 10) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_EUROPE) && strncasecmp(id, "Europe/", 7) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_INDIAN) && strncasecmp(id, "Indian/", 7) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_PACIFIC) && strncasecmp(id, "Pacific/", 8) == 0) return 1;
if ((what & PHP_DATE_TIMEZONE_GROUP_UTC) && strncasecmp(id, "UTC", 3) == 0) return 1;
return 0;
} /* }}} */

Expand Down
2 changes: 1 addition & 1 deletion ext/ffi/ffi.c
Original file line number Diff line number Diff line change
Expand Up @@ -3485,7 +3485,7 @@ static int zend_ffi_validate_incomplete_type(zend_ffi_type *type, zend_bool allo
}
zend_ffi_throw_parser_error("Incomplete type at line %d", FFI_G(line));
return FAILURE;
} else if (!allow_incomplete_array && type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY) {
} else if (!allow_incomplete_array && (type->attr & ZEND_FFI_ATTR_INCOMPLETE_ARRAY)) {
zend_ffi_throw_parser_error("'[]' not allowed at line %d", FFI_G(line));
return FAILURE;
} else if (!FFI_G(allow_vla) && (type->attr & ZEND_FFI_ATTR_VLA)) {
Expand Down
10 changes: 5 additions & 5 deletions ext/mysqlnd/mysqlnd_connection.c
Original file line number Diff line number Diff line change
Expand Up @@ -1439,7 +1439,7 @@ MYSQLND_METHOD(mysqlnd_conn_data, get_server_version)(const MYSQLND_CONN_DATA *

#define MARIA_DB_VERSION_HACK_PREFIX "5.5.5-"

if (conn->server_capabilities & CLIENT_PLUGIN_AUTH
if ((conn->server_capabilities & CLIENT_PLUGIN_AUTH)
&& !strncmp(p, MARIA_DB_VERSION_HACK_PREFIX, sizeof(MARIA_DB_VERSION_HACK_PREFIX)-1))
{
p += sizeof(MARIA_DB_VERSION_HACK_PREFIX)-1;
Expand Down Expand Up @@ -2000,24 +2000,24 @@ MYSQLND_METHOD(mysqlnd_conn_data, tx_rollback)(MYSQLND_CONN_DATA * conn)
static void
MYSQLND_METHOD(mysqlnd_conn_data, tx_cor_options_to_string)(const MYSQLND_CONN_DATA * const conn, smart_str * str, const unsigned int mode)
{
if (mode & TRANS_COR_AND_CHAIN && !(mode & TRANS_COR_AND_NO_CHAIN)) {
if ((mode & TRANS_COR_AND_CHAIN) && !(mode & TRANS_COR_AND_NO_CHAIN)) {
if (str->s && ZSTR_LEN(str->s)) {
smart_str_appendl(str, " ", sizeof(" ") - 1);
}
smart_str_appendl(str, "AND CHAIN", sizeof("AND CHAIN") - 1);
} else if (mode & TRANS_COR_AND_NO_CHAIN && !(mode & TRANS_COR_AND_CHAIN)) {
} else if ((mode & TRANS_COR_AND_NO_CHAIN) && !(mode & TRANS_COR_AND_CHAIN)) {
if (str->s && ZSTR_LEN(str->s)) {
smart_str_appendl(str, " ", sizeof(" ") - 1);
}
smart_str_appendl(str, "AND NO CHAIN", sizeof("AND NO CHAIN") - 1);
}

if (mode & TRANS_COR_RELEASE && !(mode & TRANS_COR_NO_RELEASE)) {
if ((mode & TRANS_COR_RELEASE) && !(mode & TRANS_COR_NO_RELEASE)) {
if (str->s && ZSTR_LEN(str->s)) {
smart_str_appendl(str, " ", sizeof(" ") - 1);
}
smart_str_appendl(str, "RELEASE", sizeof("RELEASE") - 1);
} else if (mode & TRANS_COR_NO_RELEASE && !(mode & TRANS_COR_RELEASE)) {
} else if ((mode & TRANS_COR_NO_RELEASE) && !(mode & TRANS_COR_RELEASE)) {
if (str->s && ZSTR_LEN(str->s)) {
smart_str_appendl(str, " ", sizeof(" ") - 1);
}
Expand Down
12 changes: 6 additions & 6 deletions ext/mysqlnd/mysqlnd_debug.h
Original file line number Diff line number Diff line change
Expand Up @@ -129,18 +129,18 @@ PHPAPI MYSQLND_DEBUG * mysqlnd_debug_init(const char * skip_functions[]);
/* EMPTY */ ; /* shut compiler's mouth */ \
} \
do { \
if (((dbg_obj1) && (dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS) || \
((dbg_obj2) && (dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) \
if (((dbg_obj1) && ((dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) || \
((dbg_obj2) && ((dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS))) \
{ \
DBG_PROFILE_START_TIME(); \
} \
} while (0);

#define DBG_LEAVE_EX2(dbg_obj1, dbg_obj2, leave) \
do {\
#define DBG_LEAVE_EX2(dbg_obj1, dbg_obj2, leave) \
do { \
uint64_t this_call_duration = 0; \
if (((dbg_obj1) && (dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS) || \
((dbg_obj2) && (dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) \
if (((dbg_obj1) && ((dbg_obj1)->flags & MYSQLND_DEBUG_PROFILE_CALLS)) || \
((dbg_obj2) && ((dbg_obj2)->flags & MYSQLND_DEBUG_PROFILE_CALLS))) \
{ \
DBG_PROFILE_END_TIME(this_call_duration); \
} \
Expand Down
2 changes: 1 addition & 1 deletion ext/mysqlnd/mysqlnd_wireprotocol.c
Original file line number Diff line number Diff line change
Expand Up @@ -1995,7 +1995,7 @@ php_mysqlnd_chg_user_read(MYSQLND_CONN_DATA * conn, void * _packet)
packet->response_code = uint1korr(p);
p++;

if (packet->header.size == 1 && buf[0] == EODATA_MARKER && packet->server_capabilities & CLIENT_SECURE_CONNECTION) {
if (packet->header.size == 1 && buf[0] == EODATA_MARKER && (packet->server_capabilities & CLIENT_SECURE_CONNECTION)) {
/* We don't handle 3.23 authentication */
packet->server_asked_323_auth = TRUE;
DBG_RETURN(FAIL);
Expand Down
4 changes: 2 additions & 2 deletions ext/opcache/Optimizer/sccp.c
Original file line number Diff line number Diff line change
Expand Up @@ -2258,7 +2258,7 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
} else if (var->use_chain >= 0
|| var->phi_use_chain != NULL) {
if (value
&& opline->result_type & (IS_VAR|IS_TMP_VAR)
&& (opline->result_type & (IS_VAR|IS_TMP_VAR))
&& opline->opcode != ZEND_QM_ASSIGN
&& opline->opcode != ZEND_ROPE_INIT
&& opline->opcode != ZEND_ROPE_ADD
Expand Down Expand Up @@ -2288,7 +2288,7 @@ static int try_remove_definition(sccp_ctx *ctx, int var_num, zend_ssa_var *var,
if (opline->opcode == ZEND_DO_ICALL) {
removed_ops = remove_call(ctx, opline, ssa_op);
} else if (opline->opcode == ZEND_TYPE_CHECK
&& opline->op1_type & (IS_VAR|IS_TMP_VAR)
&& (opline->op1_type & (IS_VAR|IS_TMP_VAR))
&& !value_known(&ctx->values[ssa_op->op1_use])) {
/* For TYPE_CHECK we may compute the result value without knowing the
* operand, based on type inference information. Make sure the operand is
Expand Down
2 changes: 1 addition & 1 deletion ext/pdo/pdo_stmt.c
Original file line number Diff line number Diff line change
Expand Up @@ -761,7 +761,7 @@ static int do_fetch(pdo_stmt_t *stmt, int do_bind, zval *return_value, enum pdo_
return 1;
}

if (flags & PDO_FETCH_GROUP && stmt->fetch.column == -1) {
if ((flags & PDO_FETCH_GROUP) && stmt->fetch.column == -1) {
colno = 1;
} else {
colno = stmt->fetch.column;
Expand Down
2 changes: 1 addition & 1 deletion ext/phar/stream.c
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ static php_stream * phar_wrapper_open_url(php_stream_wrapper *wrapper, const cha
return NULL;
}

if (!PHAR_G(cwd_init) && options & STREAM_OPEN_FOR_INCLUDE) {
if (!PHAR_G(cwd_init) && (options & STREAM_OPEN_FOR_INCLUDE)) {
char *entry = idata->internal_file->filename, *cwd;

PHAR_G(cwd_init) = 1;
Expand Down
2 changes: 1 addition & 1 deletion ext/phar/util.c
Original file line number Diff line number Diff line change
Expand Up @@ -1319,7 +1319,7 @@ phar_entry_info *phar_get_entry_info_dir(phar_archive_data *phar, char *path, si
return NULL;
}

if (ssb.sb.st_mode & S_IFDIR && !dir) {
if ((ssb.sb.st_mode & S_IFDIR) && !dir) {
efree(test);
if (error) {
spprintf(error, 4096, "phar error: path \"%s\" is a directory", path);
Expand Down
6 changes: 3 additions & 3 deletions ext/reflection/php_reflection.c
Original file line number Diff line number Diff line change
Expand Up @@ -422,7 +422,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
zend_function *mptr;

ZEND_HASH_FOREACH_PTR(&ce->function_table, mptr) {
if (mptr->common.fn_flags & ZEND_ACC_STATIC
if ((mptr->common.fn_flags & ZEND_ACC_STATIC)
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
count_static_funcs++;
Expand All @@ -436,7 +436,7 @@ static void _class_string(smart_str *str, zend_class_entry *ce, zval *obj, char
zend_function *mptr;

ZEND_HASH_FOREACH_PTR(&ce->function_table, mptr) {
if (mptr->common.fn_flags & ZEND_ACC_STATIC
if ((mptr->common.fn_flags & ZEND_ACC_STATIC)
&& ((mptr->common.fn_flags & ZEND_ACC_PRIVATE) == 0 || mptr->common.scope == ce))
{
smart_str_append_printf(str, "\n");
Expand Down Expand Up @@ -3499,7 +3499,7 @@ ZEND_METHOD(ReflectionMethod, isConstructor)
/* we need to check if the ctor is the ctor of the class level we we
* looking at since we might be looking at an inherited old style ctor
* defined in base class. */
RETURN_BOOL(mptr->common.fn_flags & ZEND_ACC_CTOR && intern->ce->constructor && intern->ce->constructor->common.scope == mptr->common.scope);
RETURN_BOOL((mptr->common.fn_flags & ZEND_ACC_CTOR) && intern->ce->constructor && intern->ce->constructor->common.scope == mptr->common.scope);
}
/* }}} */

Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_dllist.c
Original file line number Diff line number Diff line change
Expand Up @@ -701,7 +701,7 @@ PHP_METHOD(SplDoublyLinkedList, setIteratorMode)

intern = Z_SPLDLLIST_P(ZEND_THIS);

if (intern->flags & SPL_DLLIST_IT_FIX
if ((intern->flags & SPL_DLLIST_IT_FIX)
&& (intern->flags & SPL_DLLIST_IT_LIFO) != (value & SPL_DLLIST_IT_LIFO)) {
zend_throw_exception(spl_ce_RuntimeException, "Iterators' LIFO/FIFO modes for SplStack/SplQueue objects are frozen", 0);
RETURN_THROWS();
Expand Down
2 changes: 1 addition & 1 deletion ext/spl/spl_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ void spl_register_property( zend_class_entry * class_entry, char *prop_name, int
/* {{{ spl_add_class_name */
void spl_add_class_name(zval *list, zend_class_entry *pce, int allow, int ce_flags)
{
if (!allow || (allow > 0 && pce->ce_flags & ce_flags) || (allow < 0 && !(pce->ce_flags & ce_flags))) {
if (!allow || (allow > 0 && (pce->ce_flags & ce_flags)) || (allow < 0 && !(pce->ce_flags & ce_flags))) {
zval *tmp;

if ((tmp = zend_hash_find(Z_ARRVAL_P(list), pce->name)) == NULL) {
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/array.c
Original file line number Diff line number Diff line change
Expand Up @@ -4748,7 +4748,7 @@ static void php_array_intersect(INTERNAL_FUNCTION_PARAMETERS, int behavior, int
if (behavior == INTERSECT_NORMAL && data_compare_type == INTERSECT_COMP_DATA_USER) {
BG(user_compare_fci) = *fci_data;
BG(user_compare_fci_cache) = *fci_data_cache;
} else if (behavior & INTERSECT_ASSOC && key_compare_type == INTERSECT_COMP_KEY_USER) {
} else if ((behavior & INTERSECT_ASSOC) && key_compare_type == INTERSECT_COMP_KEY_USER) {
BG(user_compare_fci) = *fci_key;
BG(user_compare_fci_cache) = *fci_key_cache;
}
Expand Down Expand Up @@ -5155,7 +5155,7 @@ static void php_array_diff(INTERNAL_FUNCTION_PARAMETERS, int behavior, int data_
if (behavior == DIFF_NORMAL && data_compare_type == DIFF_COMP_DATA_USER) {
BG(user_compare_fci) = *fci_data;
BG(user_compare_fci_cache) = *fci_data_cache;
} else if (behavior & DIFF_ASSOC && key_compare_type == DIFF_COMP_KEY_USER) {
} else if ((behavior & DIFF_ASSOC) && key_compare_type == DIFF_COMP_KEY_USER) {
BG(user_compare_fci) = *fci_key;
BG(user_compare_fci_cache) = *fci_key_cache;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/file.c
Original file line number Diff line number Diff line change
Expand Up @@ -621,7 +621,7 @@ PHP_FUNCTION(file_put_contents)
RETURN_FALSE;
}

if (flags & LOCK_EX && (!php_stream_supports_lock(stream) || php_stream_lock(stream, LOCK_EX))) {
if ((flags & LOCK_EX) && (!php_stream_supports_lock(stream) || php_stream_lock(stream, LOCK_EX))) {
php_stream_close(stream);
php_error_docref(NULL, E_WARNING, "Exclusive locks are not supported for this stream");
RETURN_FALSE;
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/flock_compat.c
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ PHPAPI int php_flock(int fd, int operation)

ret = fcntl(fd, operation & LOCK_NB ? F_SETLK : F_SETLKW, &flck);

if (operation & LOCK_NB && ret == -1 &&
if ((operation & LOCK_NB) && ret == -1 &&
(errno == EACCES || errno == EAGAIN))
errno = EWOULDBLOCK;

Expand Down
2 changes: 1 addition & 1 deletion main/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -1265,7 +1265,7 @@ static ZEND_COLD void php_error_cb(int orig_type, const char *error_filename, co
}

/* display/log the error if necessary */
if (display && (EG(error_reporting) & type || (type & E_CORE))
if (display && ((EG(error_reporting) & type) || (type & E_CORE))
&& (PG(log_errors) || PG(display_errors) || (!module_initialized))) {
char *error_type_str;
int syslog_type_int = LOG_NOTICE;
Expand Down
4 changes: 2 additions & 2 deletions main/streams/memory.c
Original file line number Diff line number Diff line change
Expand Up @@ -254,9 +254,9 @@ static int php_stream_memory_set_option(php_stream *stream, int option, int valu
ms->fsize = newsize;
return PHP_STREAM_OPTION_RETURN_OK;
}
default:
return PHP_STREAM_OPTION_RETURN_NOTIMPL;
}

return PHP_STREAM_OPTION_RETURN_NOTIMPL;
}
/* }}} */

Expand Down
2 changes: 1 addition & 1 deletion main/streams/php_stream_context.h
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ END_EXTERN_C()
(context)->notifier->mask |= PHP_STREAM_NOTIFIER_PROGRESS; \
php_stream_notify_progress((context), (sofar), (bmax)); } } while (0)

#define php_stream_notify_progress_increment(context, dsofar, dmax) do { if ((context) && (context)->notifier && (context)->notifier->mask & PHP_STREAM_NOTIFIER_PROGRESS) { \
#define php_stream_notify_progress_increment(context, dsofar, dmax) do { if ((context) && (context)->notifier && ((context)->notifier->mask & PHP_STREAM_NOTIFIER_PROGRESS)) { \
(context)->notifier->progress += (dsofar); \
(context)->notifier->progress_max += (dmax); \
php_stream_notify_progress((context), (context)->notifier->progress, (context)->notifier->progress_max); } } while (0)
Expand Down
1 change: 1 addition & 0 deletions main/streams/plain_wrapper.c
Original file line number Diff line number Diff line change
Expand Up @@ -903,6 +903,7 @@ static int php_stdiop_set_option(php_stream *stream, int option, int value, void
#endif
}
}
return PHP_STREAM_OPTION_RETURN_NOTIMPL;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space indent snuck in here.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Space indent snuck in here.

sorry, I will pay attention to the indentation next time


#ifdef PHP_WIN32
case PHP_STREAM_OPTION_PIPE_BLOCKING:
Expand Down
6 changes: 3 additions & 3 deletions main/streams/streams.c
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ PHPAPI void php_stream_wrapper_log_error(const php_stream_wrapper *wrapper, int
vspprintf(&buffer, 0, fmt, args);
va_end(args);

if (options & REPORT_ERRORS || wrapper == NULL) {
if ((options & REPORT_ERRORS) || wrapper == NULL) {
php_error_docref(NULL, E_WARNING, "%s", buffer);
efree(buffer);
} else {
Expand Down Expand Up @@ -703,7 +703,7 @@ PHPAPI ssize_t _php_stream_read(php_stream *stream, char *buf, size_t size)
break;
}

if (!stream->readfilters.head && (stream->flags & PHP_STREAM_FLAG_NO_BUFFER || stream->chunk_size == 1)) {
if (!stream->readfilters.head && ((stream->flags & PHP_STREAM_FLAG_NO_BUFFER) || stream->chunk_size == 1)) {
toread = stream->ops->read(stream, buf, size);
if (toread < 0) {
/* Report an error if the read failed and we did not read any data
Expand Down Expand Up @@ -2088,7 +2088,7 @@ PHPAPI php_stream *_php_stream_open_wrapper_ex(const char *path, const char *mod
path_to_open = path;

wrapper = php_stream_locate_url_wrapper(path, &path_to_open, options);
if (options & STREAM_USE_URL && (!wrapper || !wrapper->is_url)) {
if ((options & STREAM_USE_URL) && (!wrapper || !wrapper->is_url)) {
php_error_docref(NULL, E_WARNING, "This function may only be used against URLs");
if (resolved_path) {
zend_string_release_ex(resolved_path, 0);
Expand Down
7 changes: 3 additions & 4 deletions main/streams/xp_socket.c
Original file line number Diff line number Diff line change
Expand Up @@ -449,12 +449,11 @@ static int php_sockop_set_option(php_stream *stream, int option, int value, void
#endif

default:
return PHP_STREAM_OPTION_RETURN_NOTIMPL;
break;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Also space indentation.

}

default:
return PHP_STREAM_OPTION_RETURN_NOTIMPL;
}

return PHP_STREAM_OPTION_RETURN_NOTIMPL;
}

static int php_sockop_cast(php_stream *stream, int castas, void **ret)
Expand Down
Loading