]> granicus.if.org Git - php/commitdiff
Format string fixes
authorNikita Popov <nikic@php.net>
Sun, 14 Feb 2016 13:02:19 +0000 (14:02 +0100)
committerNikita Popov <nikic@php.net>
Sun, 14 Feb 2016 13:45:53 +0000 (14:45 +0100)
Conflicts:
ext/pgsql/pgsql.c

17 files changed:
Zend/zend_API.c
ext/iconv/iconv.c
ext/mcrypt/mcrypt.c
ext/openssl/openssl.c
ext/pdo/pdo_stmt.c
ext/standard/pack.c
ext/standard/var.c
ext/zip/php_zip.c
ext/zlib/zlib.c
sapi/phpdbg/phpdbg.c
sapi/phpdbg/phpdbg_frame.c
sapi/phpdbg/phpdbg_info.c
sapi/phpdbg/phpdbg_opcode.c
sapi/phpdbg/phpdbg_print.c
sapi/phpdbg/phpdbg_prompt.c
sapi/phpdbg/phpdbg_utils.c
sapi/phpdbg/phpdbg_wait.c

index 91fb09161e4c956a94569554853c3a278cd496d6..2238bcb5e06767bb57c09302b871bcc9f02b8e20 100644 (file)
@@ -1638,7 +1638,7 @@ ZEND_API int array_set_zval_key(HashTable *ht, zval *key, zval *value) /* {{{ */
                        result = zend_symtable_update(ht, ZSTR_EMPTY_ALLOC(), value);
                        break;
                case IS_RESOURCE:
-                       zend_error(E_NOTICE, "Resource ID#" ZEND_LONG_FMT " used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
+                       zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(key), Z_RES_HANDLE_P(key));
                        result = zend_hash_index_update(ht, Z_RES_HANDLE_P(key), value);
                        break;
                case IS_FALSE:
index 309258b4c7a0a142246b5524d62ab2da82bbc3d5..4dd6784209f40ad76c255ece6b39874509fc4beb 100644 (file)
@@ -424,9 +424,9 @@ static int php_iconv_output_handler(void **nothing, php_output_context *output_c
                        char *p = strstr(get_output_encoding(), "//");
 
                        if (p) {
-                               len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, (size_t)(p - get_output_encoding()), get_output_encoding());
+                               len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%.*s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, (int) (p - get_output_encoding()), get_output_encoding());
                        } else {
-                               len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (size_t) strlen(mimetype), mimetype, get_output_encoding());
+                               len = spprintf(&content_type, 0, "Content-Type:%.*s; charset=%s", mimetype_len ? mimetype_len : (int) strlen(mimetype), mimetype, get_output_encoding());
                        }
                        if (content_type && SUCCESS == sapi_add_header(content_type, (uint)len, 0)) {
                                SG(sapi_headers).send_default_content_type = 0;
index 536edde425b52b97770aed8407977004ff8f884a..456c40ae71eaeae34ef46d1c002a9065c36881b6 100644 (file)
@@ -564,7 +564,7 @@ PHP_FUNCTION(mcrypt_generic_init)
        memset(iv_s, 0, iv_size + 1);
 
        if (key_len > max_key_size) {
-               php_error_docref(NULL, E_WARNING, "Key size too large; supplied length: %d, max: %d", key_len, max_key_size);
+               php_error_docref(NULL, E_WARNING, "Key size too large; supplied length: %zd, max: %d", key_len, max_key_size);
                key_size = max_key_size;
        } else {
                key_size = (int)key_len;
@@ -572,7 +572,7 @@ PHP_FUNCTION(mcrypt_generic_init)
        memcpy(key_s, key, key_len);
 
        if (iv_len != iv_size) {
-               php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %d, needed: %d", iv_len, iv_size);
+               php_error_docref(NULL, E_WARNING, "Iv size incorrect; supplied length: %zd, needed: %d", iv_len, iv_size);
                if (iv_len > iv_size) {
                        iv_len = iv_size;
                }
index 4eba110486e7b4453c4a9f72b59bd4fa3ea607f2..464b0b8ca9486d73bb3e7d1319b06170f1fcf943 100644 (file)
@@ -5213,14 +5213,14 @@ static zend_bool php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_
        }
 
        if (*piv_len < iv_required_len) {
-               php_error_docref(NULL, E_WARNING, "IV passed is only %d bytes long, cipher expects an IV of precisely %d bytes, padding with \\0", *piv_len, iv_required_len);
+               php_error_docref(NULL, E_WARNING, "IV passed is only %zd bytes long, cipher expects an IV of precisely %zd bytes, padding with \\0", *piv_len, iv_required_len);
                memcpy(iv_new, *piv, *piv_len);
                *piv_len = iv_required_len;
                *piv = iv_new;
                return 1;
        }
 
-       php_error_docref(NULL, E_WARNING, "IV passed is %d bytes long which is longer than the %d expected by selected cipher, truncating", *piv_len, iv_required_len);
+       php_error_docref(NULL, E_WARNING, "IV passed is %zd bytes long which is longer than the %zd expected by selected cipher, truncating", *piv_len, iv_required_len);
        memcpy(iv_new, *piv, iv_required_len);
        *piv_len = iv_required_len;
        *piv = iv_new;
index 5ca20fcd5b1e3c0fa8a6344db36a3868613e7da4..6019c39aba510744284a15151e7fc8e189f4d478 100644 (file)
@@ -2107,9 +2107,9 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
                RETURN_FALSE;
        }
 
-       php_stream_printf(out, "SQL: [%d] %.*s\n",
+       php_stream_printf(out, "SQL: [%zd] %.*s\n",
                stmt->query_stringlen,
-               stmt->query_stringlen, stmt->query_string);
+               (int) stmt->query_stringlen, stmt->query_string);
 
        php_stream_printf(out, "Params:  %d\n",
                stmt->bound_params ? zend_hash_num_elements(stmt->bound_params) : 0);
@@ -2119,13 +2119,14 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
                zend_string *key = NULL;
                ZEND_HASH_FOREACH_KEY_PTR(stmt->bound_params, num, key, param) {
                        if (key) {
-                               php_stream_printf(out, "Key: Name: [%d] %.*s\n", ZSTR_LEN(key), ZSTR_LEN(key), ZSTR_VAL(key));
+                               php_stream_printf(out, "Key: Name: [%zd] %.*s\n",
+                                       ZSTR_LEN(key), (int) ZSTR_LEN(key), ZSTR_VAL(key));
                        } else {
                                php_stream_printf(out, "Key: Position #%pd:\n", num);
                        }
 
-                       php_stream_printf(out, "paramno=%pd\nname=[%d] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
-                                       param->paramno, param->name? ZSTR_LEN(param->name) : 0, param->name? ZSTR_LEN(param->name) : 0,
+                       php_stream_printf(out, "paramno=%pd\nname=[%zd] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
+                                       param->paramno, param->name ? ZSTR_LEN(param->name) : 0, param->name ? (int) ZSTR_LEN(param->name) : 0,
                                        param->name ? ZSTR_VAL(param->name) : "",
                                        param->is_param,
                                        param->param_type);
index ab7e9c71dc413f2796066e69470b7a7c9c554ff4..a24ee69ad291cb047ee84bfb9e484ff5f930e1f5 100644 (file)
@@ -986,7 +986,7 @@ PHP_FUNCTION(unpack)
                                /* Reached end of input for '*' repeater */
                                break;
                        } else {
-                               php_error_docref(NULL, E_WARNING, "Type %c: not enough input, need %d, have %d", type, size, inputlen - inputpos);
+                               php_error_docref(NULL, E_WARNING, "Type %c: not enough input, need %d, have " ZEND_LONG_FMT, type, size, inputlen - inputpos);
                                zval_dtor(return_value);
                                RETURN_FALSE;
                        }
index 61a7179dbb308ef8020cb5137e9dfd2ca79958bc..fcee7a9cc6bff2e21e9eaa935f690950362e56e7 100644 (file)
@@ -108,7 +108,7 @@ again:
                        php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc));
                        break;
                case IS_STRING:
-                       php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc));
+                       php_printf("%sstring(%zd) \"", COMMON, Z_STRLEN_P(struc));
                        PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc));
                        PUTS("\"\n");
                        break;
@@ -278,7 +278,7 @@ again:
                php_printf("%sfloat(%.*G)\n", COMMON, (int) EG(precision), Z_DVAL_P(struc));
                break;
        case IS_STRING:
-               php_printf("%sstring(%d) \"", COMMON, Z_STRLEN_P(struc));
+               php_printf("%sstring(%zd) \"", COMMON, Z_STRLEN_P(struc));
                PHPWRITE(Z_STRVAL_P(struc), Z_STRLEN_P(struc));
                php_printf("\" refcount(%u)\n", Z_REFCOUNTED_P(struc) ? Z_REFCOUNT_P(struc) : 1);
                break;
@@ -336,7 +336,7 @@ again:
                break;
        case IS_RESOURCE: {
                const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(struc));
-               php_printf("%sresource(" ZEND_LONG_FMT ") of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc));
+               php_printf("%sresource(%d) of type (%s) refcount(%u)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown", Z_REFCOUNT_P(struc));
                break;
        }
        case IS_REFERENCE:
@@ -1045,7 +1045,8 @@ PHP_FUNCTION(unserialize)
                }
                zval_ptr_dtor(return_value);
                if (!EG(exception)) {
-                       php_error_docref(NULL, E_NOTICE, "Error at offset " ZEND_LONG_FMT " of %d bytes", (zend_long)((char*)p - buf), buf_len);
+                       php_error_docref(NULL, E_NOTICE, "Error at offset " ZEND_LONG_FMT " of %zd bytes",
+                               (zend_long)((char*)p - buf), buf_len);
                }
                RETURN_FALSE;
        }
index ff3e60e4a917980e698a4d06861035e4d394b366..83c14b58369103717d839158d09471a4bb706e75 100644 (file)
@@ -331,7 +331,7 @@ static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char
                }
 
                if (Z_STRLEN_P(option) >= MAXPATHLEN) {
-                       php_error_docref(NULL, E_WARNING, "remove_path string is too long (max: %i, %i given)",
+                       php_error_docref(NULL, E_WARNING, "remove_path string is too long (max: %d, %zd given)",
                                                MAXPATHLEN - 1, Z_STRLEN_P(option));
                        return -1;
                }
@@ -351,7 +351,7 @@ static int php_zip_parse_options(zval *options, zend_long *remove_all_path, char
                }
 
                if (Z_STRLEN_P(option) >= MAXPATHLEN) {
-                       php_error_docref(NULL, E_WARNING, "add_path string too long (max: %i, %i given)",
+                       php_error_docref(NULL, E_WARNING, "add_path string too long (max: %d, %zd given)",
                                                MAXPATHLEN - 1, Z_STRLEN_P(option));
                        return -1;
                }
index eda939d66edab4427186755466e5ea8d3d64430c..bfca0f42f784d6873022ae4a0dacc089d9359a31 100644 (file)
@@ -1064,7 +1064,7 @@ PHP_FUNCTION(deflate_init)
                case Z_DEFAULT_STRATEGY:
                        break;
                default:
-                       php_error_docref(NULL, E_WARNING, "strategy must be one of ZLIB_FILTERED, ZLIB_HUFFMAN_ONLY, ZLIB_RLE, ZLIB_FIXED or ZLIB_DEFAULT_STRATEGY", strategy);
+                       php_error_docref(NULL, E_WARNING, "strategy must be one of ZLIB_FILTERED, ZLIB_HUFFMAN_ONLY, ZLIB_RLE, ZLIB_FIXED or ZLIB_DEFAULT_STRATEGY");
                        RETURN_FALSE;
        }
 
index bf68e301fdd923acaf7b3673539d74e3cd8ae3a7..9321eed2d3a561bb05ebedbc1142bc04b47693c1 100644 (file)
@@ -558,7 +558,7 @@ static PHP_FUNCTION(phpdbg_get_executable)
                                                insert_ht = phpdbg_add_empty_array(Z_ARR_P(return_value), func->op_array.filename);
 
                                                if (by_function) {
-                                                       zend_string *fn_name = strpprintf(ZSTR_LEN(name) + ZSTR_LEN(func->op_array.function_name) + 2, "%.*s::%.*s", ZSTR_LEN(name), ZSTR_VAL(name), ZSTR_LEN(func->op_array.function_name), ZSTR_VAL(func->op_array.function_name));
+                                                       zend_string *fn_name = strpprintf(ZSTR_LEN(name) + ZSTR_LEN(func->op_array.function_name) + 2, "%.*s::%.*s", (int) ZSTR_LEN(name), ZSTR_VAL(name), (int) ZSTR_LEN(func->op_array.function_name), ZSTR_VAL(func->op_array.function_name));
                                                        insert_ht = phpdbg_add_empty_array(insert_ht, fn_name);
                                                        zend_string_release(fn_name);
                                                }
@@ -654,7 +654,7 @@ static PHP_FUNCTION(phpdbg_end_oplog)
                                        if (last_scope == NULL) {
                                                fn_name = zend_string_copy(last_function);
                                        } else {
-                                               fn_name = strpprintf(ZSTR_LEN(last_function) + ZSTR_LEN(last_scope->name) + 2, "%.*s::%.*s", ZSTR_LEN(last_scope->name), ZSTR_VAL(last_scope->name), ZSTR_LEN(last_function), ZSTR_VAL(last_function));
+                                               fn_name = strpprintf(ZSTR_LEN(last_function) + ZSTR_LEN(last_scope->name) + 2, "%.*s::%.*s", (int) ZSTR_LEN(last_scope->name), ZSTR_VAL(last_scope->name), (int) ZSTR_LEN(last_function), ZSTR_VAL(last_function));
                                        }
                                        insert_ht = phpdbg_add_empty_array(Z_ARR_P(return_value), fn_name);
                                        zend_string_release(fn_name);
@@ -896,7 +896,7 @@ static inline size_t php_sapi_phpdbg_ub_write(const char *message, size_t length
        if (PHPDBG_G(socket_fd) != -1 && !(PHPDBG_G(flags) & PHPDBG_IS_INTERACTIVE)) {
                send(PHPDBG_G(socket_fd), message, length, 0);
        }
-       return phpdbg_script(P_STDOUT, "%.*s", length, message);
+       return phpdbg_script(P_STDOUT, "%.*s", (int) length, message);
 } /* }}} */
 
 /* beginning of struct, see main/streams/plain_wrapper.c line 111 */
index 2d0c693a1edb27bd5e025923c56927eda5eed5d4..ab1b554f7627925c5467f4bd76408f7130c1c276 100644 (file)
@@ -218,7 +218,7 @@ void phpdbg_dump_backtrace(size_t num) /* {{{ */
        while ((tmp = zend_hash_get_current_data_ex(Z_ARRVAL(zbacktrace), &position))) {
                if (file) { /* userland */
                        phpdbg_out("frame #%d: ", i);
-                       phpdbg_xml("<frame %r id=\"%d\" file=\"%s\" line=\"%d\"", i, Z_STRVAL_P(file), Z_LVAL_P(line));
+                       phpdbg_xml("<frame %r id=\"%d\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"", i, Z_STRVAL_P(file), Z_LVAL_P(line));
                        phpdbg_dump_prototype(tmp);
                        phpdbg_out(" at %s:%ld\n", Z_STRVAL_P(file), Z_LVAL_P(line));
                        i++;
index 76b26ef1e08fbedab3dacd38222a2587f296f469..5d7608fa762208a9523236c97f8dfd3842af63ab 100644 (file)
@@ -120,12 +120,18 @@ PHPDBG_INFO(constants) /* {{{ */
                phpdbg_out("Address            Refs    Type      Constant\n");
                ZEND_HASH_FOREACH_PTR(&consts, data) {
 
-#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("constant", "address=\"%p\" refcount=\"%d\" type=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %.*s" msg, &data->value, Z_REFCOUNTED(data->value) ? Z_REFCOUNT(data->value) : 1, zend_zval_type_name(&data->value), ZSTR_LEN(data->name), ZSTR_VAL(data->name), ##__VA_ARGS__)
+#define VARIABLEINFO(attrs, msg, ...) \
+       phpdbg_writeln("constant", \
+               "address=\"%p\" refcount=\"%d\" type=\"%s\" name=\"%.*s\" " attrs, \
+               "%-18p %-7d %-9s %.*s" msg, &data->value, \
+               Z_REFCOUNTED(data->value) ? Z_REFCOUNT(data->value) : 1, \
+               zend_zval_type_name(&data->value), \
+               (int) ZSTR_LEN(data->name), ZSTR_VAL(data->name), ##__VA_ARGS__)
 
                        switch (Z_TYPE(data->value)) {
                                case IS_STRING:
                                        phpdbg_try_access {
-                                               VARIABLEINFO("length=\"%d\" value=\"%.*s\"", "\nstring (%d) \"%.*s%s\"", Z_STRLEN(data->value), Z_STRLEN(data->value) < 255 ? Z_STRLEN(data->value) : 255, Z_STRVAL(data->value), Z_STRLEN(data->value) > 255 ? "..." : "");
+                                               VARIABLEINFO("length=\"%zd\" value=\"%.*s\"", "\nstring (%zd) \"%.*s%s\"", Z_STRLEN(data->value), Z_STRLEN(data->value) < 255 ? (int) Z_STRLEN(data->value) : 255, Z_STRVAL(data->value), Z_STRLEN(data->value) > 255 ? "..." : "");
                                        } phpdbg_catch_access {
                                                VARIABLEINFO("", "");
                                        } phpdbg_end_try_access();
@@ -158,7 +164,7 @@ static int phpdbg_arm_auto_global(zval *ptrzv) {
 
        if (auto_global->armed) {
                if (PHPDBG_G(flags) & PHPDBG_IN_SIGNAL_HANDLER) {
-                       phpdbg_notice("variableinfo", "unreachable=\"%.*s\"", "Cannot show information about superglobal variable %.*s", ZSTR_LEN(auto_global->name), ZSTR_VAL(auto_global->name));
+                       phpdbg_notice("variableinfo", "unreachable=\"%.*s\"", "Cannot show information about superglobal variable %.*s", (int) ZSTR_LEN(auto_global->name), ZSTR_VAL(auto_global->name));
                } else {
                        auto_global->armed = auto_global->auto_global_callback(auto_global->name);
                }
@@ -224,7 +230,10 @@ static int phpdbg_print_symbols(zend_bool show_globals) {
                ZEND_HASH_FOREACH_STR_KEY_VAL(&vars, var, data) {
                        phpdbg_try_access {
                                const char *isref = "";
-#define VARIABLEINFO(attrs, msg, ...) phpdbg_writeln("variable", "address=\"%p\" refcount=\"%d\" type=\"%s\" refstatus=\"%s\" name=\"%.*s\" " attrs, "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNTED_P(data) ? Z_REFCOUNT_P(data) : 1, zend_zval_type_name(data), isref, ZSTR_LEN(var), ZSTR_VAL(var), ##__VA_ARGS__)
+#define VARIABLEINFO(attrs, msg, ...) \
+       phpdbg_writeln("variable", \
+               "address=\"%p\" refcount=\"%d\" type=\"%s\" refstatus=\"%s\" name=\"%.*s\" " attrs, \
+               "%-18p %-7d %-9s %s$%.*s" msg, data, Z_REFCOUNTED_P(data) ? Z_REFCOUNT_P(data) : 1, zend_zval_type_name(data), isref, (int) ZSTR_LEN(var), ZSTR_VAL(var), ##__VA_ARGS__)
 retry_switch:
                                switch (Z_TYPE_P(data)) {
                                        case IS_RESOURCE:
@@ -237,14 +246,14 @@ retry_switch:
                                                break;
                                        case IS_OBJECT:
                                                phpdbg_try_access {
-                                                       VARIABLEINFO("instanceof=\"%s\"", "\n|-----(instanceof)----> (%s)\n", Z_OBJCE_P(data)->name);
+                                                       VARIABLEINFO("instanceof=\"%s\"", "\n|-----(instanceof)----> (%s)\n", ZSTR_VAL(Z_OBJCE_P(data)->name));
                                                } phpdbg_catch_access {
                                                        VARIABLEINFO("instanceof=\"%s\"", "\n|-----(instanceof)----> (unknown)\n");
                                                } phpdbg_end_try_access();
                                                break;
                                        case IS_STRING:
                                                phpdbg_try_access {
-                                                       VARIABLEINFO("length=\"%d\" value=\"%.*s\"", "\nstring (%d) \"%.*s%s\"", Z_STRLEN_P(data), Z_STRLEN_P(data) < 255 ? Z_STRLEN_P(data) : 255, Z_STRVAL_P(data), Z_STRLEN_P(data) > 255 ? "..." : "");
+                                                       VARIABLEINFO("length=\"%zd\" value=\"%.*s\"", "\nstring (%zd) \"%.*s%s\"", Z_STRLEN_P(data), Z_STRLEN_P(data) < 255 ? (int) Z_STRLEN_P(data) : 255, Z_STRVAL_P(data), Z_STRLEN_P(data) > 255 ? "..." : "");
                                                } phpdbg_catch_access {
                                                        VARIABLEINFO("", "");
                                                } phpdbg_end_try_access();
@@ -369,7 +378,7 @@ static inline void phpdbg_print_class_name(zend_class_entry *ce) /* {{{ */
        const char *visibility = ce->type == ZEND_USER_CLASS ? "User" : "Internal";
        const char *type = (ce->ce_flags & ZEND_ACC_INTERFACE) ? "Interface" : (ce->ce_flags & ZEND_ACC_ABSTRACT) ? "Abstract Class" : "Class";
 
-       phpdbg_writeln("class", "type=\"%s\" flags=\"%s\" name=\"%.*s\" methodcount=\"%d\"", "%s %s %.*s (%d)", visibility, type, ZSTR_LEN(ce->name), ZSTR_VAL(ce->name), zend_hash_num_elements(&ce->function_table));
+       phpdbg_writeln("class", "type=\"%s\" flags=\"%s\" name=\"%.*s\" methodcount=\"%d\"", "%s %s %.*s (%d)", visibility, type, (int) ZSTR_LEN(ce->name), ZSTR_VAL(ce->name), zend_hash_num_elements(&ce->function_table));
 } /* }}} */
 
 PHPDBG_INFO(classes) /* {{{ */
index fd9c92811d807bb57e88adf9ffeb9dbc025337a2..0ea4324845232adb59d7bc8bad2c2214245d15f8 100644 (file)
@@ -49,10 +49,10 @@ static inline char *phpdbg_decode_op(zend_op_array *ops, znode_op *op, uint32_t
                } break;
 
                case IS_VAR:
-                       spprintf(&decode, 0, "@%td", EX_VAR_TO_NUM(op->var) - ops->last_var);
+                       spprintf(&decode, 0, "@%u", EX_VAR_TO_NUM(op->var) - ops->last_var);
                break;
                case IS_TMP_VAR:
-                       spprintf(&decode, 0, "~%td", EX_VAR_TO_NUM(op->var) - ops->last_var);
+                       spprintf(&decode, 0, "~%u", EX_VAR_TO_NUM(op->var) - ops->last_var);
                break;
                case IS_CONST: {
                        zval *literal = RT_CONSTANT(ops, *op);
index 6b6c706f92b9fa9b8f7315a6e598020200251919..abfad0219af7e03955cc53413cfa06f830012a4c 100644 (file)
@@ -278,7 +278,7 @@ void phpdbg_print_opcodes_function(const char *function, size_t len) {
                return;
        }
 
-       phpdbg_out("function name: %.*s\n", ZSTR_LEN(func->op_array.function_name), ZSTR_VAL(func->op_array.function_name));
+       phpdbg_out("function name: %.*s\n", (int) ZSTR_LEN(func->op_array.function_name), ZSTR_VAL(func->op_array.function_name));
        phpdbg_print_function_helper(func);
 }
 
@@ -351,7 +351,7 @@ static void phpdbg_print_opcodes_ce(zend_class_entry *ce) {
        phpdbg_out("\n");
 
        ZEND_HASH_FOREACH_STR_KEY_PTR(&ce->function_table, method_name, method) {
-               phpdbg_out("\nfunction name: %s\n", method_name);
+               phpdbg_out("\nfunction name: %s\n", ZSTR_VAL(method_name));
                phpdbg_print_function_helper(method);
        } ZEND_HASH_FOREACH_END();
 }
index 97249765f8a40bcc87bdb0475bdb6e620abf4f1d..0314442daa891d583e2e2c3b49edb9a112ff1ab0 100644 (file)
@@ -1518,7 +1518,11 @@ void phpdbg_execute_ex(zend_execute_data *execute_data) /* {{{ */
                        line = zval_get_long(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("line"), 1, &rv));
                        msg = zval_get_string(zend_read_property(zend_get_exception_base(&zv), &zv, ZEND_STRL("message"), 1, &rv));
 
-                       phpdbg_error("exception", "name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"", "Uncaught %s in %s on line " ZEND_LONG_FMT ": %.*s", ZSTR_VAL(exception->ce->name), ZSTR_VAL(file), line, ZSTR_LEN(msg) < 80 ? ZSTR_LEN(msg) : 80, ZSTR_VAL(msg));
+                       phpdbg_error("exception",
+                               "name=\"%s\" file=\"%s\" line=\"" ZEND_LONG_FMT "\"",
+                               "Uncaught %s in %s on line " ZEND_LONG_FMT ": %.*s",
+                               ZSTR_VAL(exception->ce->name), ZSTR_VAL(file), line,
+                               ZSTR_LEN(msg) < 80 ? (int) ZSTR_LEN(msg) : 80, ZSTR_VAL(msg));
                        zend_string_release(msg);
                        zend_string_release(file);
 
index 696e11e762d51147b1dcf754c78c66b9cc892857..a944d256aeb7642ea1de5b29a25b2ce45cadca40 100644 (file)
@@ -484,11 +484,11 @@ PHPDBG_API int phpdbg_parse_variable_with_arg(char *input, size_t len, HashTable
                                                key = ZSTR_VAL(strkey);
                                                keylen = ZSTR_LEN(strkey);
                                        } else {
-                                               keylen = spprintf(&key, 0, "%llu", numkey);
+                                               keylen = spprintf(&key, 0, ZEND_ULONG_FMT, numkey);
                                        }
                                        propkey = phpdbg_get_property_key(key);
                                        name = emalloc(i + keylen + 2);
-                                       namelen = sprintf(name, "%.*s%.*s%s", (int) i, input, keylen - (propkey - key), propkey, input[len - 1] == ']'?"]":"");
+                                       namelen = sprintf(name, "%.*s%.*s%s", (int) i, input, (int) (keylen - (propkey - key)), propkey, input[len - 1] == ']'?"]":"");
                                        if (!strkey) {
                                                efree(key);
                                        }
@@ -597,7 +597,7 @@ static int phpdbg_xml_array_element_dump(zval *zv, zend_string *key, zend_ulong
 
        phpdbg_try_access {
                if (key) { /* string key */
-                       phpdbg_xml(" name=\"%.*s\"", ZSTR_LEN(key), ZSTR_VAL(key));
+                       phpdbg_xml(" name=\"%.*s\"", (int) ZSTR_LEN(key), ZSTR_VAL(key));
                } else { /* numeric key */
                        phpdbg_xml(" name=\"%ld\"", num);
                }
@@ -631,7 +631,7 @@ static int phpdbg_xml_object_property_dump(zval *zv, zend_string *key, zend_ulon
                                        phpdbg_xml(" class=\"%s\" protection=\"private\"", class_name);
                                }
                        } else {
-                               phpdbg_xml(" name=\"%.*s\" protection=\"public\"", ZSTR_LEN(key), ZSTR_VAL(key));
+                               phpdbg_xml(" name=\"%.*s\" protection=\"public\"", (int) ZSTR_LEN(key), ZSTR_VAL(key));
                        }
                } else { /* numeric key */
                        phpdbg_xml(" name=\"%ld\" protection=\"public\"", num);
@@ -683,7 +683,7 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) {
                                phpdbg_xml("<float refstatus=\"%s\" value=\"%.*G\" />", COMMON, (int) EG(precision), Z_DVAL_P(zv));
                                break;
                        case IS_STRING:
-                               phpdbg_xml("<string refstatus=\"%s\" length=\"%d\" value=\"%.*s\" />", COMMON, Z_STRLEN_P(zv), Z_STRLEN_P(zv), Z_STRVAL_P(zv));
+                               phpdbg_xml("<string refstatus=\"%s\" length=\"%zd\" value=\"%.*s\" />", COMMON, Z_STRLEN_P(zv), (int) Z_STRLEN_P(zv), Z_STRVAL_P(zv));
                                break;
                        case IS_ARRAY:
                                myht = Z_ARRVAL_P(zv);
@@ -705,7 +705,7 @@ PHPDBG_API void phpdbg_xml_var_dump(zval *zv) {
                                }
 
                                class_name = Z_OBJ_HANDLER_P(zv, get_class_name)(Z_OBJ_P(zv));
-                               phpdbg_xml("<object refstatus=\"%s\" class=\"%.*s\" id=\"%d\" num=\"%d\">", COMMON, ZSTR_LEN(class_name), ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(zv), myht ? zend_hash_num_elements(myht) : 0);
+                               phpdbg_xml("<object refstatus=\"%s\" class=\"%.*s\" id=\"%d\" num=\"%d\">", COMMON, (int) ZSTR_LEN(class_name), ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(zv), myht ? zend_hash_num_elements(myht) : 0);
                                zend_string_release(class_name);
 
                                element_dump_func = phpdbg_xml_object_property_dump;
@@ -729,7 +729,7 @@ head_done:
                                break;
                        case IS_RESOURCE: {
                                const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(zv));
-                               phpdbg_xml("<resource refstatus=\"%s\" id=\"%pd\" type=\"%ld\" />", COMMON, Z_RES_P(zv)->handle, type_name ? type_name : "unknown");
+                               phpdbg_xml("<resource refstatus=\"%s\" id=\"%pd\" type=\"%s\" />", COMMON, Z_RES_P(zv)->handle, type_name ? type_name : "unknown");
                                break;
                        }
                        default:
index 180b48c864482c791240d1c27ec379a39a84e116..c3ae23b7cd9a356dee556674ce64d9079b17af5b 100644 (file)
@@ -231,7 +231,7 @@ void phpdbg_webdata_decompress(char *msg, int len) {
                        } else if (mode > 0) {
                                // not loaded module
                                if (!sapi_module.name || strcmp(sapi_module.name, Z_STRVAL_P(module))) {
-                                       phpdbg_notice("wait", "missingmodule=\"%.*s\"", "The module %.*s isn't present in " PHPDBG_NAME ", you still can load via dl /path/to/module/%.*s.so", Z_STRLEN_P(module), Z_STRVAL_P(module), Z_STRLEN_P(module), Z_STRVAL_P(module));
+                                       phpdbg_notice("wait", "missingmodule=\"%.*s\"", "The module %.*s isn't present in " PHPDBG_NAME ", you still can load via dl /path/to/module/%.*s.so", (int) Z_STRLEN_P(module), Z_STRVAL_P(module), (int) Z_STRLEN_P(module), Z_STRVAL_P(module));
                                }
                        }
                } while (module);
@@ -292,7 +292,7 @@ void phpdbg_webdata_decompress(char *msg, int len) {
 
                ZEND_HASH_FOREACH_VAL(Z_ARRVAL_P(zvp), name) {
                        if (Z_TYPE_P(name) == IS_STRING) {
-                               phpdbg_notice("wait", "missingextension=\"%.*s\"", "The Zend extension %.*s isn't present in " PHPDBG_NAME ", you still can load via dl /path/to/extension.so", Z_STRLEN_P(name), Z_STRVAL_P(name));
+                               phpdbg_notice("wait", "missingextension=\"%.*s\"", "The Zend extension %.*s isn't present in " PHPDBG_NAME ", you still can load via dl /path/to/extension.so", (int) Z_STRLEN_P(name), Z_STRVAL_P(name));
                        }
                } ZEND_HASH_FOREACH_END();
        }