]> granicus.if.org Git - php/commitdiff
Fix expression warnings and break warnings
authortwosee <twose@qq.com>
Sun, 7 Jun 2020 00:38:13 +0000 (08:38 +0800)
committerNikita Popov <nikita.ppv@gmail.com>
Sun, 7 Jun 2020 08:41:11 +0000 (10:41 +0200)
Close GH-5675.

27 files changed:
Zend/zend_API.c
Zend/zend_closures.c
Zend/zend_compile.c
Zend/zend_object_handlers.c
ext/date/php_date.c
ext/ffi/ffi.c
ext/mysqlnd/mysqlnd_connection.c
ext/mysqlnd/mysqlnd_debug.h
ext/mysqlnd/mysqlnd_wireprotocol.c
ext/opcache/Optimizer/sccp.c
ext/pdo/pdo_stmt.c
ext/phar/stream.c
ext/phar/util.c
ext/reflection/php_reflection.c
ext/spl/spl_dllist.c
ext/spl/spl_functions.c
ext/standard/array.c
ext/standard/file.c
ext/standard/flock_compat.c
main/main.c
main/streams/memory.c
main/streams/php_stream_context.h
main/streams/plain_wrapper.c
main/streams/streams.c
main/streams/xp_socket.c
sapi/cli/php_cli_server.c
sapi/cli/php_http_parser.c

index f65937e3943226a5ba283e3a68c85245a7d670e4..82c5fbdf7ca153da94a32701c8ffabf250b25832 100644 (file)
@@ -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 {
@@ -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;
                                        }
@@ -3096,7 +3096,7 @@ get_function_via_handler:
        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;
                }
        }
index 6bd5a8716b2ced7685ebcdd7f6f1b2d968eece92..af008c3628fa57e29ef1d5345a3c8443b6a0f011 100644 (file)
@@ -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));
        }
 }
index 83c2573d791dc8251157580252bc6ffea1115c64..86e169893ab3bc41b356b8bb52d9edbb9874f449 100644 (file)
@@ -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);
        }
@@ -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);
        }
@@ -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);
@@ -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;
                        }
 
index ce5411b0406bd15a478f2d5fa48635f98af1e35a..81a1b7b776b29c6ae3eec4ac8a0f30530959abf7 100644 (file)
@@ -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;
                        }
index 32c22cfd1bf249fac6039d8492810adcaad50356..51c56afb3c5d040b911346b6a2fd33000774f1c8 100644 (file)
@@ -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;
 } /* }}} */
 
index e4ea0099c1492d1dec48b04da5b877c07c74e059..e54f1dd8d4d7e88b03f242babe5e6c401354771e 100644 (file)
@@ -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)) {
index 27ef38c61e733808762db8cf1ad57afc6cad2eb0..252c05f676dd27eeab49b903ff8f4012130e7462 100644 (file)
@@ -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;
@@ -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);
                }
index 49d2f8426a713cb862216293b87cdbc99b076188..79d53ad700d02f63b23a9c5389b6dd36545c829d 100644 (file)
@@ -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); \
                                } \
index 10fabd59dacbfb2442d2c989d5d7d8f535f02f49..7526c42ae6c16394a6a2243e9a1e2012fec4e77d 100644 (file)
@@ -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);
index 4d15af9e4f325358a85792cddddab0574209ecca..b2d6dcf9e74d0a1ffcb7bd8275218b24d1accb19 100644 (file)
@@ -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
@@ -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
index b095425cafd7afd117825d2571ff6b1a7219913d..8bdd52d906855f31023fc339534d7f2aa0f1968c 100644 (file)
@@ -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;
index f3de4dde252493eaf70e7c309b82f09d2b1378be..bdc15683de78383b5ee87f9d21bc7917a7192e4a 100644 (file)
@@ -318,7 +318,7 @@ idata_error:
                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;
index 53982b0f85206fa6e91fd3b425a0cf81c9eebda4..35322734d0992c54c09bc8bd9e879db62cc924e9 100644 (file)
@@ -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);
index d986f828f57b782c6708e456348c1b7263084812..9903863391ffc34c9b6ee40a36e4a6007f4d94be 100644 (file)
@@ -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++;
@@ -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");
@@ -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);
 }
 /* }}} */
 
index b11cfacc3c7fa0ef20bbcdf02e1231b47c015a49..0462c46aa47cf3ecccdd25f74f5f44c9cd6cb754 100644 (file)
@@ -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();
index 6a44ab3cfb00f42e5963d33d379b469cc9a34f53..946f6e0ad9b0d3d14244ad23ff98c7985de65512 100644 (file)
@@ -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) {
index 1789dd52d248cc1c20ed99409956c7f15fb6108c..eda7ef589c99698cafefa9397f6318f06fd2c1d0 100644 (file)
@@ -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;
        }
@@ -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;
        }
index 9f096ff772917a430259d84d411c9d7c42c79b8c..cdd6d767dbc6927f72ffd383dda7a2d7340d8613 100644 (file)
@@ -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;
index ecf28d85130af378ff477996d1645566d4cc629c..6751aedfc19905e3c8fb7d9fa6bb80a58cb454a6 100644 (file)
@@ -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;
 
index f3abf58b13b60ac7aa8f7ca10c643307ab5bb452..8599022c138e23f18f5d322b76d15178c29541dc 100644 (file)
@@ -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;
index 35be57d3c38f1de033054cddbdf762f36c4663ce..cd3a5cb9505ea81d187fd47fa05bc6149e0e865e 100644 (file)
@@ -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;
 }
 /* }}} */
 
index 98daa114a52ba95b72c0fdfe1648bfa7cde6fb07..29c9ae28a6f55708b5a43aabc08c3f02865e3d40 100644 (file)
@@ -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)
index edde4121b8a50f26571b92ec395117b2e0124897..b855fe9db9a03ec3ec8206ec6ad48b7454895043 100644 (file)
@@ -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;
 
 #ifdef PHP_WIN32
                case PHP_STREAM_OPTION_PIPE_BLOCKING:
index 9762fa90e8438b6b6a18110aadfeba780b29bac0..90475a8d90afebe5aece3bee01d7c3e7509da3dd 100644 (file)
@@ -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 {
@@ -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
@@ -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);
index 77b18fd2df6b8010f5884ee3173411b26e926c77..f3370e89f7e69dea5256f8fa57ddf66148aacf8e 100644 (file)
@@ -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;
                        }
-
-               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)
index b9c5aa523b38be02cb70c55f6c29463050dd40d9..4a25455374c64a6ed001e9248a3c37508fa084ca 100644 (file)
@@ -1833,7 +1833,7 @@ static int php_cli_server_client_read_request(php_cli_server_client *client, cha
        nbytes_consumed = php_http_parser_execute(&client->parser, &settings, buf, nbytes_read);
        if (nbytes_consumed != (size_t)nbytes_read) {
                if (php_cli_server_log_level >= PHP_CLI_SERVER_LOG_ERROR) {
-                       if (buf[0] & 0x80 /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
+                       if ((buf[0] & 0x80) /* SSLv2 */ || buf[0] == 0x16 /* SSLv3/TLSv1 */) {
                                *errstr = estrdup("Unsupported SSL request");
                        } else {
                                *errstr = estrdup("Malformed HTTP request");
index 6d764b6c0dff07e08109e4350fa4e4c899ca27ee..bb1c4924a0d495c2abee96beaf60a992fde76899 100644 (file)
@@ -1315,7 +1315,7 @@ size_t php_http_parser_execute (php_http_parser *parser,
 
         nread = 0;
 
-        if (parser->flags & F_UPGRADE || parser->method == PHP_HTTP_CONNECT) {
+        if ((parser->flags & F_UPGRADE) || parser->method == PHP_HTTP_CONNECT) {
           parser->upgrade = 1;
         }