summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Zend/zend.h10
-rw-r--r--Zend/zend_API.c4
-rw-r--r--Zend/zend_alloc.c14
-rw-r--r--Zend/zend_compile.c2
-rw-r--r--Zend/zend_exceptions.c2
-rw-r--r--Zend/zend_exceptions.h6
-rw-r--r--Zend/zend_execute.c4
-rw-r--r--Zend/zend_execute_API.c4
-rw-r--r--Zend/zend_hash.c6
-rw-r--r--Zend/zend_long.h12
-rw-r--r--Zend/zend_vm_def.h2
-rw-r--r--Zend/zend_vm_execute.h8
-rw-r--r--ext/bz2/bz2_filter.c4
-rw-r--r--ext/calendar/calendar.c8
-rw-r--r--ext/fileinfo/fileinfo.c4
-rw-r--r--ext/ftp/php_ftp.c4
-rw-r--r--ext/gd/gd.c6
-rw-r--r--ext/gmp/gmp.c6
-rw-r--r--ext/imap/php_imap.c2
-rw-r--r--ext/interbase/ibase_service.c4
-rw-r--r--ext/interbase/php_ibase_includes.h2
-rw-r--r--ext/intl/converter/converter.c4
-rw-r--r--ext/intl/dateformat/dateformat_format.c2
-rw-r--r--ext/intl/formatter/formatter_format.c2
-rw-r--r--ext/intl/formatter/formatter_parse.c2
-rw-r--r--ext/ldap/ldap.c6
-rw-r--r--ext/mbstring/mb_gpc.c2
-rw-r--r--ext/mysqli/mysqli_api.c2
-rw-r--r--ext/mysqli/mysqli_nonapi.c8
-rw-r--r--ext/oci8/oci8.c8
-rw-r--r--ext/oci8/oci8_lob.c6
-rw-r--r--ext/oci8/oci8_statement.c6
-rw-r--r--ext/opcache/ZendAccelerator.c24
-rw-r--r--ext/opcache/zend_accelerator_debug.h2
-rw-r--r--ext/opcache/zend_accelerator_module.c26
-rw-r--r--ext/opcache/zend_shared_alloc.c4
-rw-r--r--ext/openssl/openssl.c2
-rw-r--r--ext/pdo/pdo.c2
-rw-r--r--ext/pdo/pdo_dbh.c2
-rw-r--r--ext/pdo/pdo_stmt.c4
-rw-r--r--ext/pdo_pgsql/pgsql_driver.c8
-rw-r--r--ext/pdo_pgsql/pgsql_statement.c4
-rw-r--r--ext/pgsql/pgsql.c22
-rw-r--r--ext/phar/func_interceptors.c2
-rw-r--r--ext/phar/phar_object.c28
-rw-r--r--ext/pspell/pspell.c6
-rw-r--r--ext/session/php_session.h2
-rw-r--r--ext/simplexml/simplexml.c10
-rw-r--r--ext/snmp/snmp.c8
-rw-r--r--ext/soap/php_encoding.c2
-rw-r--r--ext/soap/php_http.c2
-rw-r--r--ext/soap/soap.c4
-rw-r--r--ext/sockets/conversions.c12
-rw-r--r--ext/sockets/multicast.c2
-rw-r--r--ext/sockets/sendrecvmsg.c6
-rw-r--r--ext/sockets/sockets.c8
-rw-r--r--ext/spl/php_spl.c2
-rw-r--r--ext/spl/spl_array.c12
-rw-r--r--ext/spl/spl_directory.c6
-rw-r--r--ext/spl/spl_dllist.c2
-rw-r--r--ext/spl/spl_iterators.c12
-rw-r--r--ext/spl/spl_observer.c2
-rw-r--r--ext/standard/array.c2
-rw-r--r--ext/standard/assert.c2
-rw-r--r--ext/standard/dir.c6
-rw-r--r--ext/standard/file.c4
-rw-r--r--ext/standard/formatted_print.c2
-rw-r--r--ext/standard/ftp_fopen_wrapper.c4
-rw-r--r--ext/standard/http.c2
-rw-r--r--ext/standard/http_fopen_wrapper.c4
-rw-r--r--ext/standard/math.c4
-rw-r--r--ext/standard/proc_open.c2
-rw-r--r--ext/standard/streamsfuncs.c4
-rw-r--r--ext/standard/var.c2
-rw-r--r--ext/standard/var_unserializer.c2
-rw-r--r--ext/standard/var_unserializer.re2
-rw-r--r--ext/sysvmsg/sysvmsg.c4
-rw-r--r--ext/sysvsem/sysvsem.c16
-rw-r--r--ext/sysvshm/sysvshm.c12
-rw-r--r--ext/xmlrpc/xmlrpc-epi-php.c2
-rw-r--r--ext/zip/php_zip.c2
-rw-r--r--ext/zlib/zlib.c12
-rw-r--r--ext/zlib/zlib_filter.c8
-rw-r--r--main/SAPI.c2
-rw-r--r--main/SAPI.h2
-rw-r--r--main/fastcgi.h2
-rw-r--r--main/main.c4
-rw-r--r--main/rfc1867.c6
-rw-r--r--main/snprintf.h6
-rw-r--r--main/streams/xp_socket.c2
-rw-r--r--sapi/cli/php_cli_server.c2
-rw-r--r--sapi/fpm/fpm/fpm_log.c4
92 files changed, 261 insertions, 257 deletions
diff --git a/Zend/zend.h b/Zend/zend.h
index 1e0a5613e6..f473e2cc21 100644
--- a/Zend/zend.h
+++ b/Zend/zend.h
@@ -71,9 +71,9 @@ ZEND_TSRMLS_CACHE_EXTERN()
#ifdef HAVE_NORETURN
# ifdef ZEND_NORETURN_ALIAS
-ZEND_COLD void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN;
+ZEND_COLD void zend_error_noreturn(int type, const char *format, ...) ZEND_NORETURN ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
# else
-ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...);
+ZEND_API ZEND_COLD ZEND_NORETURN void zend_error_noreturn(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
# endif
#else
# define zend_error_noreturn zend_error
@@ -267,9 +267,9 @@ extern ZEND_API char *(*zend_getenv)(char *name, size_t name_len);
extern ZEND_API zend_string *(*zend_resolve_path)(const char *filename, int filename_len);
ZEND_API ZEND_COLD void zend_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
-ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...);
-ZEND_API ZEND_COLD void zend_type_error(const char *format, ...);
-ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...);
+ZEND_API ZEND_COLD void zend_throw_error(zend_class_entry *exception_ce, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
+ZEND_API ZEND_COLD void zend_type_error(const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 1, 2);
+ZEND_API ZEND_COLD void zend_internal_type_error(zend_bool throw_exception, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
ZEND_COLD void zenderror(const char *error);
diff --git a/Zend/zend_API.c b/Zend/zend_API.c
index 18d8382934..0de75c005c 100644
--- a/Zend/zend_API.c
+++ b/Zend/zend_API.c
@@ -3846,7 +3846,7 @@ ZEND_API void zend_update_property_ex(zend_class_entry *scope, zval *object, zen
EG(fake_scope) = scope;
if (!Z_OBJ_HT_P(object)->write_property) {
- zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be updated", name, ZSTR_VAL(Z_OBJCE_P(object)->name));
+ zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be updated", ZSTR_VAL(name), ZSTR_VAL(Z_OBJCE_P(object)->name));
}
ZVAL_STR(&property, name);
Z_OBJ_HT_P(object)->write_property(object, &property, value, NULL);
@@ -4041,7 +4041,7 @@ ZEND_API zval *zend_read_property_ex(zend_class_entry *scope, zval *object, zend
EG(fake_scope) = scope;
if (!Z_OBJ_HT_P(object)->read_property) {
- zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be read", name, ZSTR_VAL(Z_OBJCE_P(object)->name));
+ zend_error_noreturn(E_CORE_ERROR, "Property %s of class %s cannot be read", ZSTR_VAL(name), ZSTR_VAL(Z_OBJCE_P(object)->name));
}
ZVAL_STR(&property, name);
diff --git a/Zend/zend_alloc.c b/Zend/zend_alloc.c
index a7e3808e7c..76664c01ce 100644
--- a/Zend/zend_alloc.c
+++ b/Zend/zend_alloc.c
@@ -193,14 +193,6 @@ typedef struct _zend_mm_free_slot zend_mm_free_slot;
typedef struct _zend_mm_chunk zend_mm_chunk;
typedef struct _zend_mm_huge_list zend_mm_huge_list;
-#ifdef _WIN64
-# define PTR_FMT "0x%0.16I64x"
-#elif SIZEOF_LONG == 8
-# define PTR_FMT "0x%0.16lx"
-#else
-# define PTR_FMT "0x%0.8lx"
-#endif
-
#ifdef MAP_HUGETLB
int zend_mm_use_huge_pages = 0;
#endif
@@ -2515,7 +2507,7 @@ ZEND_API char* ZEND_FASTCALL _estrdup(const char *s ZEND_FILE_LINE_DC ZEND_FILE_
length = strlen(s);
if (UNEXPECTED(length + 1 == 0)) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", 1, length, 1);
+ zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (1 * %zu + 1)", length);
}
p = (char *) _emalloc(length + 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
if (UNEXPECTED(p == NULL)) {
@@ -2530,7 +2522,7 @@ ZEND_API char* ZEND_FASTCALL _estrndup(const char *s, size_t length ZEND_FILE_LI
char *p;
if (UNEXPECTED(length + 1 == 0)) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", 1, length, 1);
+ zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (1 * %zu + 1)", length);
}
p = (char *) _emalloc(length + 1 ZEND_FILE_LINE_RELAY_CC ZEND_FILE_LINE_ORIG_RELAY_CC);
if (UNEXPECTED(p == NULL)) {
@@ -2547,7 +2539,7 @@ ZEND_API char* ZEND_FASTCALL zend_strndup(const char *s, size_t length)
char *p;
if (UNEXPECTED(length + 1 == 0)) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", 1, length, 1);
+ zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (1 * %zu + 1)", length);
}
p = (char *) malloc(length + 1);
if (UNEXPECTED(p == NULL)) {
diff --git a/Zend/zend_compile.c b/Zend/zend_compile.c
index 1d544c6561..7780066b27 100644
--- a/Zend/zend_compile.c
+++ b/Zend/zend_compile.c
@@ -1151,7 +1151,7 @@ ZEND_API zend_class_entry *do_bind_inherited_class(const zend_op_array *op_array
* so we shut up about it. This allows the if (!defined('FOO')) { return; }
* approach to work.
*/
- zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s, because the name is already in use", zend_get_object_type(Z_OBJCE_P(lcname)), Z_STRVAL_P(lcname));
+ zend_error_noreturn(E_COMPILE_ERROR, "Cannot declare %s, because the name is already in use", zend_get_object_type(Z_OBJCE_P(lcname)));
}
return NULL;
}
diff --git a/Zend/zend_exceptions.c b/Zend/zend_exceptions.c
index 4a85e4e73a..047c115472 100644
--- a/Zend/zend_exceptions.c
+++ b/Zend/zend_exceptions.c
@@ -617,7 +617,7 @@ ZEND_METHOD(exception, getTraceAsString)
}
ZEND_HASH_FOREACH_NUM_KEY_VAL(Z_ARRVAL_P(trace), index, frame) {
if (Z_TYPE_P(frame) != IS_ARRAY) {
- zend_error(E_WARNING, "Expected array for frame %pu", index);
+ zend_error(E_WARNING, "Expected array for frame " ZEND_ULONG_FMT, index);
continue;
}
diff --git a/Zend/zend_exceptions.h b/Zend/zend_exceptions.h
index d351c2468d..04857f29fa 100644
--- a/Zend/zend_exceptions.h
+++ b/Zend/zend_exceptions.h
@@ -56,7 +56,7 @@ ZEND_API void zend_register_default_classes(void);
/* exception_ce NULL, zend_ce_exception, zend_ce_error, or a derived class
* message NULL or the message of the exception */
ZEND_API ZEND_COLD zend_object *zend_throw_exception(zend_class_entry *exception_ce, const char *message, zend_long code);
-ZEND_API ZEND_COLD zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...);
+ZEND_API ZEND_COLD zend_object *zend_throw_exception_ex(zend_class_entry *exception_ce, zend_long code, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 3, 4);
ZEND_API ZEND_COLD void zend_throw_exception_object(zval *exception);
ZEND_API void zend_clear_exception(void);
@@ -68,8 +68,8 @@ extern ZEND_API void (*zend_throw_exception_hook)(zval *ex);
ZEND_API ZEND_COLD void zend_exception_error(zend_object *exception, int severity);
/* do not export, in php it's available thru spprintf directly */
-size_t zend_spprintf(char **message, size_t max_len, const char *format, ...);
-zend_string *zend_strpprintf(size_t max_len, const char *format, ...);
+size_t zend_spprintf(char **message, size_t max_len, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 3, 4);
+zend_string *zend_strpprintf(size_t max_len, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
END_EXTERN_C()
diff --git a/Zend/zend_execute.c b/Zend/zend_execute.c
index a41c9dd594..c8d2f7c513 100644
--- a/Zend/zend_execute.c
+++ b/Zend/zend_execute.c
@@ -1607,7 +1607,7 @@ str_index:
hval = zend_dval_to_lval(Z_DVAL_P(dim));
goto num_index;
case IS_RESOURCE:
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
+ zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_HANDLE_P(dim), Z_RES_HANDLE_P(dim));
hval = Z_RES_HANDLE_P(dim);
goto num_index;
case IS_FALSE:
@@ -1833,7 +1833,7 @@ try_string_offset:
if (UNEXPECTED(Z_STRLEN_P(container) < (size_t)((offset < 0) ? -offset : (offset + 1)))) {
if (type != BP_VAR_IS) {
- zend_error(E_NOTICE, "Uninitialized string offset: %pd", offset);
+ zend_error(E_NOTICE, "Uninitialized string offset: " ZEND_LONG_FMT, offset);
ZVAL_EMPTY_STRING(result);
} else {
ZVAL_NULL(result);
diff --git a/Zend/zend_execute_API.c b/Zend/zend_execute_API.c
index f7bce4f4e5..d292de19e4 100644
--- a/Zend/zend_execute_API.c
+++ b/Zend/zend_execute_API.c
@@ -1175,7 +1175,7 @@ ZEND_API ZEND_NORETURN void zend_timeout(int dummy) /* {{{ */
zend_set_timeout_ex(0, 1);
#endif
- zend_error_noreturn(E_ERROR, "Maximum execution time of %pd second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
+ zend_error_noreturn(E_ERROR, "Maximum execution time of " ZEND_LONG_FMT " second%s exceeded", EG(timeout_seconds), EG(timeout_seconds) == 1 ? "" : "s");
}
/* }}} */
@@ -1205,7 +1205,7 @@ static void zend_timeout_handler(int dummy) /* {{{ */
error_filename = "Unknown";
}
- zend_spprintf(&log_buffer, 0, "\nFatal error: Maximum execution time of %pd+%pd seconds exceeded (terminated) in %s on line %d\n", EG(timeout_seconds), EG(hard_timeout), error_filename, error_lineno);
+ zend_spprintf(&log_buffer, 0, "\nFatal error: Maximum execution time of " ZEND_LONG_FMT "+" ZEND_LONG_FMT " seconds exceeded (terminated) in %s on line %d\n", EG(timeout_seconds), EG(hard_timeout), error_filename, error_lineno);
write(2, log_buffer, strlen(log_buffer));
_exit(1);
}
diff --git a/Zend/zend_hash.c b/Zend/zend_hash.c
index 47215d3511..b59d5885a6 100644
--- a/Zend/zend_hash.c
+++ b/Zend/zend_hash.c
@@ -103,7 +103,7 @@ static zend_always_inline uint32_t zend_hash_check_size(uint32_t nSize)
if (nSize < HT_MIN_SIZE) {
nSize = HT_MIN_SIZE;
} else if (UNEXPECTED(nSize >= HT_MAX_SIZE)) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", nSize, sizeof(Bucket), sizeof(Bucket));
+ zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%u * %zu + %zu)", nSize, sizeof(Bucket), sizeof(Bucket));
}
#if defined(ZEND_WIN32)
@@ -189,7 +189,7 @@ static void ZEND_FASTCALL zend_hash_packed_grow(HashTable *ht)
{
HT_ASSERT(GC_REFCOUNT(ht) == 1);
if (ht->nTableSize >= HT_MAX_SIZE) {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", ht->nTableSize * 2, sizeof(Bucket), sizeof(Bucket));
+ zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%u * %zu + %zu)", ht->nTableSize * 2, sizeof(Bucket), sizeof(Bucket));
}
ht->nTableSize += ht->nTableSize;
HT_SET_DATA_ADDR(ht, perealloc2(HT_GET_DATA_ADDR(ht), HT_SIZE(ht), HT_USED_SIZE(ht), ht->u.flags & HASH_FLAG_PERSISTENT));
@@ -869,7 +869,7 @@ static void ZEND_FASTCALL zend_hash_do_resize(HashTable *ht)
pefree(old_data, ht->u.flags & HASH_FLAG_PERSISTENT);
zend_hash_rehash(ht);
} else {
- zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%zu * %zu + %zu)", ht->nTableSize * 2, sizeof(Bucket) + sizeof(uint32_t), sizeof(Bucket));
+ zend_error_noreturn(E_ERROR, "Possible integer overflow in memory allocation (%u * %zu + %zu)", ht->nTableSize * 2, sizeof(Bucket) + sizeof(uint32_t), sizeof(Bucket));
}
}
diff --git a/Zend/zend_long.h b/Zend/zend_long.h
index 60d1c71d3c..e6713da871 100644
--- a/Zend/zend_long.h
+++ b/Zend/zend_long.h
@@ -59,6 +59,7 @@ typedef int32_t zend_off_t;
#ifdef ZEND_ENABLE_ZVAL_LONG64
# define ZEND_LONG_FMT "%" PRId64
# define ZEND_ULONG_FMT "%" PRIu64
+# define ZEND_XLONG_FMT "%" PRIx64
# define ZEND_LONG_FMT_SPEC PRId64
# define ZEND_ULONG_FMT_SPEC PRIu64
# ifdef ZEND_WIN32
@@ -87,6 +88,7 @@ typedef int32_t zend_off_t;
# define ZEND_STRTOUL(s0, s1, base) strtoul((s0), (s1), (base))
# define ZEND_LONG_FMT "%" PRId32
# define ZEND_ULONG_FMT "%" PRIu32
+# define ZEND_XLONG_FMT "%" PRIx32
# define ZEND_LONG_FMT_SPEC PRId32
# define ZEND_ULONG_FMT_SPEC PRIu32
# ifdef ZEND_WIN32
@@ -117,6 +119,16 @@ typedef int32_t zend_off_t;
static const char long_min_digits[] = LONG_MIN_DIGITS;
+#ifdef _WIN64
+# define ZEND_ADDR_FMT "0x%016I64x"
+#elif SIZEOF_SIZE_T == 4
+# define ZEND_ADDR_FMT "0x%08zx"
+#elif SIZEOF_SIZE_T == 8
+# define ZEND_ADDR_FMT "0x%016zx"
+#else
+# error "Unknown SIZEOF_SIZE_T"
+#endif
+
#endif /* ZEND_LONG_H */
/*
diff --git a/Zend/zend_vm_def.h b/Zend/zend_vm_def.h
index 4742a62b58..c8e9eb12a5 100644
--- a/Zend/zend_vm_def.h
+++ b/Zend/zend_vm_def.h
@@ -7548,7 +7548,7 @@ ZEND_VM_HANDLER(142, ZEND_YIELD_FROM, CONST|TMP|VAR|CV, ANY)
ZVAL_OBJ(&generator->values, &iter->std);
}
} else {
- zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables", 0);
+ zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
HANDLE_EXCEPTION();
}
diff --git a/Zend/zend_vm_execute.h b/Zend/zend_vm_execute.h
index b0da3c043d..837cab2b56 100644
--- a/Zend/zend_vm_execute.h
+++ b/Zend/zend_vm_execute.h
@@ -3925,7 +3925,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CONST_HANDLER(
ZVAL_OBJ(&generator->values, &iter->std);
}
} else {
- zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables", 0);
+ zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
HANDLE_EXCEPTION();
}
@@ -13002,7 +13002,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_TMP_HANDLER(ZE
ZVAL_OBJ(&generator->values, &iter->std);
}
} else {
- zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables", 0);
+ zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
HANDLE_EXCEPTION();
}
@@ -16949,7 +16949,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_VAR_HANDLER(ZE
ZVAL_OBJ(&generator->values, &iter->std);
}
} else {
- zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables", 0);
+ zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
HANDLE_EXCEPTION();
}
@@ -35670,7 +35670,7 @@ static ZEND_OPCODE_HANDLER_RET ZEND_FASTCALL ZEND_YIELD_FROM_SPEC_CV_HANDLER(ZEN
ZVAL_OBJ(&generator->values, &iter->std);
}
} else {
- zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables", 0);
+ zend_throw_error(NULL, "Can use \"yield from\" only with arrays and Traversables");
HANDLE_EXCEPTION();
}
diff --git a/ext/bz2/bz2_filter.c b/ext/bz2/bz2_filter.c
index b076f9554e..2211549fe8 100644
--- a/ext/bz2/bz2_filter.c
+++ b/ext/bz2/bz2_filter.c
@@ -379,7 +379,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
/* How much memory to allocate (1 - 9) x 100kb */
zend_long blocks = zval_get_long(tmpzval);
if (blocks < 1 || blocks > 9) {
- php_error_docref(NULL, E_WARNING, "Invalid parameter given for number of blocks to allocate. (%pd)", blocks);
+ php_error_docref(NULL, E_WARNING, "Invalid parameter given for number of blocks to allocate. (" ZEND_LONG_FMT ")", blocks);
} else {
blockSize100k = (int) blocks;
}
@@ -389,7 +389,7 @@ static php_stream_filter *php_bz2_filter_create(const char *filtername, zval *fi
/* Work Factor (0 - 250) */
zend_long work = zval_get_long(tmpzval);
if (work < 0 || work > 250) {
- php_error_docref(NULL, E_WARNING, "Invalid parameter given for work factor. (%pd)", work);
+ php_error_docref(NULL, E_WARNING, "Invalid parameter given for work factor. (" ZEND_LONG_FMT ")", work);
} else {
workFactor = (int) work;
}
diff --git a/ext/calendar/calendar.c b/ext/calendar/calendar.c
index 78d772adce..ad2332c540 100644
--- a/ext/calendar/calendar.c
+++ b/ext/calendar/calendar.c
@@ -311,7 +311,7 @@ PHP_FUNCTION(cal_info)
if (cal != -1 && (cal < 0 || cal >= CAL_NUM_CALS)) {
- php_error_docref(NULL, E_WARNING, "invalid calendar ID %pd.", cal);
+ php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT ".", cal);
RETURN_FALSE;
}
@@ -333,7 +333,7 @@ PHP_FUNCTION(cal_days_in_month)
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL, E_WARNING, "invalid calendar ID %pd.", cal);
+ php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT ".", cal);
RETURN_FALSE;
}
@@ -375,7 +375,7 @@ PHP_FUNCTION(cal_to_jd)
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL, E_WARNING, "invalid calendar ID %pd.", cal);
+ php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT ".", cal);
RETURN_FALSE;
}
@@ -397,7 +397,7 @@ PHP_FUNCTION(cal_from_jd)
}
if (cal < 0 || cal >= CAL_NUM_CALS) {
- php_error_docref(NULL, E_WARNING, "invalid calendar ID %pd", cal);
+ php_error_docref(NULL, E_WARNING, "invalid calendar ID " ZEND_LONG_FMT "", cal);
RETURN_FALSE;
}
calendar = &cal_conversion_table[cal];
diff --git a/ext/fileinfo/fileinfo.c b/ext/fileinfo/fileinfo.c
index cc56e188fd..1473900999 100644
--- a/ext/fileinfo/fileinfo.c
+++ b/ext/fileinfo/fileinfo.c
@@ -173,7 +173,7 @@ zend_function_entry finfo_class_functions[] = {
#define FINFO_SET_OPTION(magic, options) \
if (magic_setflags(magic, options) == -1) { \
- php_error_docref(NULL, E_WARNING, "Failed to set option '%pd' %d:%s", \
+ php_error_docref(NULL, E_WARNING, "Failed to set option '" ZEND_LONG_FMT "' %d:%s", \
options, magic_errno(magic), magic_error(magic)); \
RETURN_FALSE; \
}
@@ -340,7 +340,7 @@ PHP_FUNCTION(finfo_open)
if (finfo->magic == NULL) {
efree(finfo);
- php_error_docref(NULL, E_WARNING, "Invalid mode '%pd'.", options);
+ php_error_docref(NULL, E_WARNING, "Invalid mode '" ZEND_LONG_FMT "'.", options);
if (object) {
zend_restore_error_handling(&zeh);
if (!EG(exception)) {
diff --git a/ext/ftp/php_ftp.c b/ext/ftp/php_ftp.c
index 5bbca446b2..8afd3e2b6d 100644
--- a/ext/ftp/php_ftp.c
+++ b/ext/ftp/php_ftp.c
@@ -1491,7 +1491,7 @@ PHP_FUNCTION(ftp_set_option)
RETURN_TRUE;
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown option '%pd'", option);
+ php_error_docref(NULL, E_WARNING, "Unknown option '" ZEND_LONG_FMT "'", option);
RETURN_FALSE;
break;
}
@@ -1525,7 +1525,7 @@ PHP_FUNCTION(ftp_get_option)
RETURN_BOOL(ftp->usepasvaddress);
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown option '%pd'", option);
+ php_error_docref(NULL, E_WARNING, "Unknown option '" ZEND_LONG_FMT "'", option);
RETURN_FALSE;
break;
}
diff --git a/ext/gd/gd.c b/ext/gd/gd.c
index b09990938d..ff6dea69b3 100644
--- a/ext/gd/gd.c
+++ b/ext/gd/gd.c
@@ -2809,14 +2809,14 @@ PHP_FUNCTION(imagecolorat)
if (im->tpixels && gdImageBoundsSafe(im, x, y)) {
RETURN_LONG(gdImageTrueColorPixel(im, x, y));
} else {
- php_error_docref(NULL, E_NOTICE, "%pd,%pd is out of bounds", x, y);
+ php_error_docref(NULL, E_NOTICE, "" ZEND_LONG_FMT "," ZEND_LONG_FMT " is out of bounds", x, y);
RETURN_FALSE;
}
} else {
if (im->pixels && gdImageBoundsSafe(im, x, y)) {
RETURN_LONG(im->pixels[y][x]);
} else {
- php_error_docref(NULL, E_NOTICE, "%pd,%pd is out of bounds", x, y);
+ php_error_docref(NULL, E_NOTICE, "" ZEND_LONG_FMT "," ZEND_LONG_FMT " is out of bounds", x, y);
RETURN_FALSE;
}
}
@@ -4850,7 +4850,7 @@ PHP_FUNCTION(imageaffinematrixget)
}
default:
- php_error_docref(NULL, E_WARNING, "Invalid type for element %li", type);
+ php_error_docref(NULL, E_WARNING, "Invalid type for element " ZEND_LONG_FMT, type);
RETURN_FALSE;
}
diff --git a/ext/gmp/gmp.c b/ext/gmp/gmp.c
index a1e15899c9..b751725e3f 100644
--- a/ext/gmp/gmp.c
+++ b/ext/gmp/gmp.c
@@ -1033,7 +1033,7 @@ ZEND_FUNCTION(gmp_init)
}
if (base && (base < 2 || base > GMP_MAX_BASE)) {
- php_error_docref(NULL, E_WARNING, "Bad base for conversion: %pd (should be between 2 and %d)", base, GMP_MAX_BASE);
+ php_error_docref(NULL, E_WARNING, "Bad base for conversion: " ZEND_LONG_FMT " (should be between 2 and %d)", base, GMP_MAX_BASE);
RETURN_FALSE;
}
@@ -1049,7 +1049,7 @@ int gmp_import_export_validate(zend_long size, zend_long options, int *order, in
{
if (size < 1) {
php_error_docref(NULL, E_WARNING,
- "Word size must be positive, %pd given", size);
+ "Word size must be positive, " ZEND_LONG_FMT " given", size);
return FAILURE;
}
@@ -1190,7 +1190,7 @@ ZEND_FUNCTION(gmp_strval)
/* Although the maximum base in general in GMP is 62, mpz_get_str()
* is explicitly limited to -36 when dealing with negative bases. */
if ((base < 2 && base > -2) || base > GMP_MAX_BASE || base < -36) {
- php_error_docref(NULL, E_WARNING, "Bad base for conversion: %pd (should be between 2 and %d or -2 and -36)", base, GMP_MAX_BASE);
+ php_error_docref(NULL, E_WARNING, "Bad base for conversion: " ZEND_LONG_FMT " (should be between 2 and %d or -2 and -36)", base, GMP_MAX_BASE);
RETURN_FALSE;
}
diff --git a/ext/imap/php_imap.c b/ext/imap/php_imap.c
index 2ce1070838..dcad868db4 100644
--- a/ext/imap/php_imap.c
+++ b/ext/imap/php_imap.c
@@ -2912,7 +2912,7 @@ PHP_FUNCTION(imap_utf7_decode)
#if PHP_DEBUG
/* warn if we computed outlen incorrectly */
if (outp - out != outlen) {
- php_error_docref(NULL, E_WARNING, "outp - out [%ld] != outlen [%d]", outp - out, outlen);
+ php_error_docref(NULL, E_WARNING, "outp - out [%zd] != outlen [%d]", outp - out, outlen);
}
#endif
diff --git a/ext/interbase/ibase_service.c b/ext/interbase/ibase_service.c
index 3116ab9def..8905805a36 100644
--- a/ext/interbase/ibase_service.c
+++ b/ext/interbase/ibase_service.c
@@ -226,7 +226,7 @@ PHP_FUNCTION(ibase_service_attach)
user, isc_spb_password, (char)plen, pass, host);
if (spb_len > sizeof(buf) || spb_len == -1) {
- _php_ibase_module_error("Internal error: insufficient buffer space for SPB (%d)", spb_len);
+ _php_ibase_module_error("Internal error: insufficient buffer space for SPB (%zd)", spb_len);
RETURN_FALSE;
}
@@ -450,7 +450,7 @@ static void _php_ibase_backup_restore(INTERNAL_FUNCTION_PARAMETERS, char operati
}
if (spb_len > sizeof(buf) || spb_len <= 0) {
- _php_ibase_module_error("Internal error: insufficient buffer space for SPB (%d)", spb_len);
+ _php_ibase_module_error("Internal error: insufficient buffer space for SPB (%zd)", spb_len);
RETURN_FALSE;
}
diff --git a/ext/interbase/php_ibase_includes.h b/ext/interbase/php_ibase_includes.h
index e2000c1c5f..c8b8a529aa 100644
--- a/ext/interbase/php_ibase_includes.h
+++ b/ext/interbase/php_ibase_includes.h
@@ -151,7 +151,7 @@ typedef void (*info_func_t)(char*);
void _php_ibase_error(void);
void _php_ibase_module_error(char *, ...)
- PHP_ATTRIBUTE_FORMAT(printf,1,PHP_ATTR_FMT_OFFSET +2);
+ PHP_ATTRIBUTE_FORMAT(printf,1,2);
/* determine if a resource is a link or transaction handle */
#define PHP_IBASE_LINK_TRANS(zv, lh, th) \
diff --git a/ext/intl/converter/converter.c b/ext/intl/converter/converter.c
index 5653b46365..94752d437b 100644
--- a/ext/intl/converter/converter.c
+++ b/ext/intl/converter/converter.c
@@ -152,7 +152,7 @@ static PHP_METHOD(UConverter, fromUCallback) {
/* {{{ php_converter_check_limits */
static inline zend_bool php_converter_check_limits(php_converter_object *objval, zend_long available, zend_long needed) {
if (available < needed) {
- php_converter_throw_failure(objval, U_BUFFER_OVERFLOW_ERROR, "Buffer overrun %pd bytes needed, %pd available", needed, available);
+ php_converter_throw_failure(objval, U_BUFFER_OVERFLOW_ERROR, "Buffer overrun " ZEND_LONG_FMT " bytes needed, " ZEND_LONG_FMT " available", needed, available);
return 0;
}
return 1;
@@ -732,7 +732,7 @@ static PHP_METHOD(UConverter, reasonText) {
UCNV_REASON_CASE(CLOSE)
UCNV_REASON_CASE(CLONE)
default:
- php_error_docref(NULL, E_WARNING, "Unknown UConverterCallbackReason: %pd", reason);
+ php_error_docref(NULL, E_WARNING, "Unknown UConverterCallbackReason: " ZEND_LONG_FMT, reason);
RETURN_FALSE;
}
}
diff --git a/ext/intl/dateformat/dateformat_format.c b/ext/intl/dateformat/dateformat_format.c
index dda1dd4fd7..c3ae472222 100644
--- a/ext/intl/dateformat/dateformat_format.c
+++ b/ext/intl/dateformat/dateformat_format.c
@@ -79,7 +79,7 @@ static int32_t internal_get_arr_ele(IntlDateFormatter_object *dfo,
} else {
if (Z_LVAL_P(ele_value) > INT32_MAX ||
Z_LVAL_P(ele_value) < INT32_MIN) {
- spprintf(&message, 0, "datefmt_format: value %pd is out of "
+ spprintf(&message, 0, "datefmt_format: value " ZEND_LONG_FMT " is out of "
"bounds for a 32-bit integer in key '%s'",
Z_LVAL_P(ele_value), key_name);
intl_errors_set(err, U_ILLEGAL_ARGUMENT_ERROR, message, 1);
diff --git a/ext/intl/formatter/formatter_format.c b/ext/intl/formatter/formatter_format.c
index 369756ebdb..5668f0ba20 100644
--- a/ext/intl/formatter/formatter_format.c
+++ b/ext/intl/formatter/formatter_format.c
@@ -119,7 +119,7 @@ PHP_FUNCTION( numfmt_format )
break;
default:
- php_error_docref(NULL, E_WARNING, "Unsupported format type %pd", type);
+ php_error_docref(NULL, E_WARNING, "Unsupported format type " ZEND_LONG_FMT, type);
RETURN_FALSE;
break;
}
diff --git a/ext/intl/formatter/formatter_parse.c b/ext/intl/formatter/formatter_parse.c
index f0d42cfabe..9b414d0027 100644
--- a/ext/intl/formatter/formatter_parse.c
+++ b/ext/intl/formatter/formatter_parse.c
@@ -97,7 +97,7 @@ PHP_FUNCTION( numfmt_parse )
RETVAL_DOUBLE(val_double);
break;
default:
- php_error_docref(NULL, E_WARNING, "Unsupported format type %pd", type);
+ php_error_docref(NULL, E_WARNING, "Unsupported format type " ZEND_LONG_FMT, type);
RETVAL_FALSE;
break;
}
diff --git a/ext/ldap/ldap.c b/ext/ldap/ldap.c
index c439c7358d..501552f86a 100644
--- a/ext/ldap/ldap.c
+++ b/ext/ldap/ldap.c
@@ -357,7 +357,7 @@ PHP_FUNCTION(ldap_connect)
#endif
if (LDAPG(max_links) != -1 && LDAPG(num_links) >= LDAPG(max_links)) {
- php_error_docref(NULL, E_WARNING, "Too many open links (%pd)", LDAPG(num_links));
+ php_error_docref(NULL, E_WARNING, "Too many open links (" ZEND_LONG_FMT ")", LDAPG(num_links));
RETURN_FALSE;
}
@@ -370,12 +370,12 @@ PHP_FUNCTION(ldap_connect)
int urllen = hostlen + sizeof( "ldap://:65535" );
if (port <= 0 || port > 65535) {
- php_error_docref(NULL, E_WARNING, "invalid port number: %ld", port);
+ php_error_docref(NULL, E_WARNING, "invalid port number: " ZEND_LONG_FMT, port);
RETURN_FALSE;
}
url = emalloc(urllen);
- snprintf( url, urllen, "ldap://%s:%ld", host ? host : "", port );
+ snprintf( url, urllen, "ldap://%s:" ZEND_LONG_FMT, host ? host : "", port );
}
#ifdef LDAP_API_FEATURE_X_OPENLDAP
diff --git a/ext/mbstring/mb_gpc.c b/ext/mbstring/mb_gpc.c
index aea4baf6a3..88eb2b7e0c 100644
--- a/ext/mbstring/mb_gpc.c
+++ b/ext/mbstring/mb_gpc.c
@@ -254,7 +254,7 @@ const mbfl_encoding *_php_mb_encoding_handler_ex(const php_mb_encoding_handler_i
}
if (n > (PG(max_input_vars) * 2)) {
- php_error_docref(NULL, E_WARNING, "Input variables exceeded %pd. To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
+ php_error_docref(NULL, E_WARNING, "Input variables exceeded " ZEND_LONG_FMT ". To increase the limit change max_input_vars in php.ini.", PG(max_input_vars));
goto out;
}
diff --git a/ext/mysqli/mysqli_api.c b/ext/mysqli/mysqli_api.c
index 333e890f3b..f9c5dbc764 100644
--- a/ext/mysqli/mysqli_api.c
+++ b/ext/mysqli/mysqli_api.c
@@ -2333,7 +2333,7 @@ PHP_FUNCTION(mysqli_stmt_attr_set)
MYSQLI_FETCH_RESOURCE_STMT(stmt, mysql_stmt, MYSQLI_STATUS_VALID);
if (mode_in < 0) {
- php_error_docref(NULL, E_WARNING, "mode should be non-negative, %pd passed", mode_in);
+ php_error_docref(NULL, E_WARNING, "mode should be non-negative, " ZEND_LONG_FMT " passed", mode_in);
RETURN_FALSE;
}
diff --git a/ext/mysqli/mysqli_nonapi.c b/ext/mysqli/mysqli_nonapi.c
index 49db7bbfe6..e3efca25c6 100644
--- a/ext/mysqli/mysqli_nonapi.c
+++ b/ext/mysqli/mysqli_nonapi.c
@@ -156,7 +156,7 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
} else {
mysql->persistent = persistent = TRUE;
- hash_key = strpprintf(0, "mysqli_%s_%s%ld%s%s%s", SAFE_STR(hostname), SAFE_STR(socket),
+ hash_key = strpprintf(0, "mysqli_%s_%s" ZEND_LONG_FMT "%s%s%s", SAFE_STR(hostname), SAFE_STR(socket),
port, SAFE_STR(username), SAFE_STR(dbname),
SAFE_STR(passwd));
@@ -202,14 +202,14 @@ void mysqli_common_connect(INTERNAL_FUNCTION_PARAMETERS, zend_bool is_real_conne
}
}
if (MyG(max_links) != -1 && MyG(num_links) >= MyG(max_links)) {
- php_error_docref(NULL, E_WARNING, "Too many open links (%pd)", MyG(num_links));
+ php_error_docref(NULL, E_WARNING, "Too many open links (" ZEND_LONG_FMT ")", MyG(num_links));
goto err;
}
if (persistent && MyG(max_persistent) != -1 &&
(MyG(num_active_persistent) + MyG(num_inactive_persistent))>= MyG(max_persistent))
{
- php_error_docref(NULL, E_WARNING, "Too many open persistent links (%pd)",
+ php_error_docref(NULL, E_WARNING, "Too many open persistent links (" ZEND_LONG_FMT ")",
MyG(num_active_persistent) + MyG(num_inactive_persistent));
goto err;
}
@@ -1088,7 +1088,7 @@ PHP_FUNCTION(mysqli_begin_transaction)
}
MYSQLI_FETCH_RESOURCE_CONN(mysql, mysql_link, MYSQLI_STATUS_VALID);
if (flags < 0) {
- php_error_docref(NULL, E_WARNING, "Invalid value for parameter flags (%pd)", flags);
+ php_error_docref(NULL, E_WARNING, "Invalid value for parameter flags (" ZEND_LONG_FMT ")", flags);
err = TRUE;
}
if (!name_len) {
diff --git a/ext/oci8/oci8.c b/ext/oci8/oci8.c
index 120f055a3a..51861b090c 100644
--- a/ext/oci8/oci8.c
+++ b/ext/oci8/oci8.c
@@ -1231,9 +1231,9 @@ PHP_MINFO_FUNCTION(oci)
php_info_print_table_start();
php_info_print_table_header(2, "Statistics", "");
- snprintf(buf, sizeof(buf), "%pd", OCI_G(num_persistent));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, OCI_G(num_persistent));
php_info_print_table_row(2, "Active Persistent Connections", buf);
- snprintf(buf, sizeof(buf), "%pd", OCI_G(num_links));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, OCI_G(num_links));
php_info_print_table_row(2, "Active Connections", buf);
php_info_print_table_end();
}
@@ -1662,7 +1662,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
ub2 charsetid_nls_lang = 0;
if (session_mode & ~(OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) {
- php_error_docref(NULL, E_WARNING, "Invalid session mode specified (%pd)", session_mode);
+ php_error_docref(NULL, E_WARNING, "Invalid session mode specified (" ZEND_LONG_FMT ")", session_mode);
return NULL;
}
if (session_mode & (OCI_SYSOPER | OCI_SYSDBA | PHP_OCI_CRED_EXT)) {
@@ -1930,7 +1930,7 @@ php_oci_connection *php_oci_do_connect_ex(char *username, int username_len, char
if (OCI_G(max_persistent) != -1 && OCI_G(num_persistent) >= OCI_G(max_persistent)) {
/* all persistent connactions are in use, fallback to non-persistent connection creation */
- php_error_docref(NULL, E_NOTICE, "Too many open persistent connections (%pd)", OCI_G(num_persistent));
+ php_error_docref(NULL, E_NOTICE, "Too many open persistent connections (" ZEND_LONG_FMT ")", OCI_G(num_persistent));
alloc_non_persistent = 1;
}
}
diff --git a/ext/oci8/oci8_lob.c b/ext/oci8/oci8_lob.c
index 78ba8f11fa..036b14efe8 100644
--- a/ext/oci8/oci8_lob.c
+++ b/ext/oci8/oci8_lob.c
@@ -63,7 +63,7 @@ php_oci_descriptor *php_oci_lob_create (php_oci_connection *connection, zend_lon
/* these three are allowed */
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown descriptor type %pd", type);
+ php_error_docref(NULL, E_WARNING, "Unknown descriptor type " ZEND_LONG_FMT, type);
return NULL;
break;
}
@@ -630,7 +630,7 @@ int php_oci_lob_flush(php_oci_descriptor *descriptor, zend_long flush_flag)
/* only these two are allowed */
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid flag value: %pd", flush_flag);
+ php_error_docref(NULL, E_WARNING, "Invalid flag value: " ZEND_LONG_FMT, flush_flag);
return 1;
break;
}
@@ -909,7 +909,7 @@ int php_oci_lob_write_tmp (php_oci_descriptor *descriptor, zend_long type, char
/* only these two are allowed */
break;
default:
- php_error_docref(NULL, E_WARNING, "Invalid temporary lob type: %pd", type);
+ php_error_docref(NULL, E_WARNING, "Invalid temporary lob type: " ZEND_LONG_FMT, type);
return 1;
break;
}
diff --git a/ext/oci8/oci8_statement.c b/ext/oci8/oci8_statement.c
index 55983d3e9f..a570e700c8 100644
--- a/ext/oci8/oci8_statement.c
+++ b/ext/oci8/oci8_statement.c
@@ -1507,7 +1507,7 @@ php_oci_out_column *php_oci_statement_get_column_helper(INTERNAL_FUNCTION_PARAME
convert_to_long(&tmp);
column = php_oci_statement_get_column(statement, Z_LVAL(tmp), NULL, 0);
if (!column) {
- php_error_docref(NULL, E_WARNING, "Invalid column index \"%pd\"", Z_LVAL(tmp));
+ php_error_docref(NULL, E_WARNING, "Invalid column index \"" ZEND_LONG_FMT "\"", Z_LVAL(tmp));
zval_dtor(&tmp);
return NULL;
}
@@ -1574,7 +1574,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t
convert_to_array(var);
if (maxlength < -1) {
- php_error_docref(NULL, E_WARNING, "Invalid max length value (%pd)", maxlength);
+ php_error_docref(NULL, E_WARNING, "Invalid max length value (" ZEND_LONG_FMT ")", maxlength);
return 1;
}
@@ -1605,7 +1605,7 @@ int php_oci_bind_array_by_name(php_oci_statement *statement, char *name, size_t
bind = php_oci_bind_array_helper_date(var, max_table_length, statement->connection);
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown or unsupported datatype given: %pd", type);
+ php_error_docref(NULL, E_WARNING, "Unknown or unsupported datatype given: " ZEND_LONG_FMT, type);
return 1;
break;
}
diff --git a/ext/opcache/ZendAccelerator.c b/ext/opcache/ZendAccelerator.c
index 71c3b55776..be8a57c341 100644
--- a/ext/opcache/ZendAccelerator.c
+++ b/ext/opcache/ZendAccelerator.c
@@ -683,7 +683,7 @@ static inline int accel_is_inactive(void)
if (ZCG(accel_directives).force_restart_timeout
&& ZCSG(force_restart_time)
&& time(NULL) >= ZCSG(force_restart_time)) {
- zend_accel_error(ACCEL_LOG_WARNING, "Forced restart at %d (after %d seconds), locked by %d", time(NULL), ZCG(accel_directives).force_restart_timeout, mem_usage_check.l_pid);
+ zend_accel_error(ACCEL_LOG_WARNING, "Forced restart at %ld (after " ZEND_LONG_FMT " seconds), locked by %d", time(NULL), ZCG(accel_directives).force_restart_timeout, mem_usage_check.l_pid);
kill_all_lockers(&mem_usage_check);
return FAILURE; /* next request should be able to restart it */
@@ -1227,11 +1227,11 @@ static zend_persistent_script *cache_script_in_file_cache(zend_persistent_script
if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
zend_accel_error(
((char*)new_persistent_script->mem + new_persistent_script->size < (char*)ZCG(mem)) ? ACCEL_LOG_ERROR : ACCEL_LOG_WARNING,
- "Internal error: wrong size calculation: %s start=0x%08x, end=0x%08x, real=0x%08x\n",
+ "Internal error: wrong size calculation: %s start=" ZEND_ADDR_FMT ", end=" ZEND_ADDR_FMT ", real=" ZEND_ADDR_FMT "\n",
ZSTR_VAL(new_persistent_script->script.filename),
- new_persistent_script->mem,
- (char *)new_persistent_script->mem + new_persistent_script->size,
- ZCG(mem));
+ (size_t)new_persistent_script->mem,
+ (size_t)((char *)new_persistent_script->mem + new_persistent_script->size),
+ (size_t)ZCG(mem));
}
new_persistent_script->dynamic_members.checksum = zend_accel_script_checksum(new_persistent_script);
@@ -1321,11 +1321,11 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
if ((char*)new_persistent_script->mem + new_persistent_script->size != (char*)ZCG(mem)) {
zend_accel_error(
((char*)new_persistent_script->mem + new_persistent_script->size < (char*)ZCG(mem)) ? ACCEL_LOG_ERROR : ACCEL_LOG_WARNING,
- "Internal error: wrong size calculation: %s start=0x%08x, end=0x%08x, real=0x%08x\n",
+ "Internal error: wrong size calculation: %s start=" ZEND_ADDR_FMT ", end=" ZEND_ADDR_FMT ", real=" ZEND_ADDR_FMT "\n",
ZSTR_VAL(new_persistent_script->script.filename),
- new_persistent_script->mem,
- (char *)new_persistent_script->mem + new_persistent_script->size,
- ZCG(mem));
+ (size_t)new_persistent_script->mem,
+ (size_t)((char *)new_persistent_script->mem + new_persistent_script->size),
+ (size_t)ZCG(mem));
}
new_persistent_script->dynamic_members.checksum = zend_accel_script_checksum(new_persistent_script);
@@ -1333,7 +1333,7 @@ static zend_persistent_script *cache_script_in_shared_memory(zend_persistent_scr
/* store script structure in the hash table */
bucket = zend_accel_hash_update(&ZCSG(hash), ZSTR_VAL(new_persistent_script->script.filename), ZSTR_LEN(new_persistent_script->script.filename), 0, new_persistent_script);
if (bucket) {
- zend_accel_error(ACCEL_LOG_INFO, "Cached script '%s'", new_persistent_script->script.filename);
+ zend_accel_error(ACCEL_LOG_INFO, "Cached script '%s'", ZSTR_VAL(new_persistent_script->script.filename));
if (key &&
/* key may contain non-persistent PHAR aliases (see issues #115 and #149) */
memcmp(key, "phar://", sizeof("phar://") - 1) != 0 &&
@@ -1790,8 +1790,8 @@ zend_op_array *persistent_compile_file(zend_file_handle *file_handle, int type)
unsigned int checksum = zend_accel_script_checksum(persistent_script);
if (checksum != persistent_script->dynamic_members.checksum ) {
/* The checksum is wrong */
- zend_accel_error(ACCEL_LOG_INFO, "Checksum failed for '%s': expected=0x%0.8X, found=0x%0.8X",
- persistent_script->script.filename, persistent_script->dynamic_members.checksum, checksum);
+ zend_accel_error(ACCEL_LOG_INFO, "Checksum failed for '%s': expected=0x%08x, found=0x%08x",
+ ZSTR_VAL(persistent_script->script.filename), persistent_script->dynamic_members.checksum, checksum);
zend_shared_alloc_lock();
if (!persistent_script->corrupted) {
persistent_script->corrupted = 1;
diff --git a/ext/opcache/zend_accelerator_debug.h b/ext/opcache/zend_accelerator_debug.h
index 5522605013..4b8d82b4ac 100644
--- a/ext/opcache/zend_accelerator_debug.h
+++ b/ext/opcache/zend_accelerator_debug.h
@@ -28,6 +28,6 @@
#define ACCEL_LOG_INFO 3
#define ACCEL_LOG_DEBUG 4
-void zend_accel_error(int type, const char *format, ...);
+void zend_accel_error(int type, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);;
#endif /* _ZEND_ACCELERATOR_DEBUG_H */
diff --git a/ext/opcache/zend_accelerator_module.c b/ext/opcache/zend_accelerator_module.c
index 61698b4a9f..0e1069836c 100644
--- a/ext/opcache/zend_accelerator_module.c
+++ b/ext/opcache/zend_accelerator_module.c
@@ -200,7 +200,7 @@ static ZEND_INI_MH(OnUpdateMaxWastedPercentage)
percentage = 5;
zend_accel_error(ACCEL_LOG_WARNING, "opcache.max_wasted_percentage must be set between 1 and 50.\n");
- zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use 5%.\n");
+ zend_accel_error(ACCEL_LOG_WARNING, ACCELERATOR_PRODUCT_NAME " will use 5%%.\n");
if ((ini_entry = zend_hash_str_find_ptr(EG(ini_directives),
"opcache.max_wasted_percentage",
sizeof("opcache.max_wasted_percentage")-1)) == NULL) {
@@ -474,33 +474,33 @@ void zend_accel_info(ZEND_MODULE_INFO_FUNC_ARGS)
char buf[32];
php_info_print_table_row(2, "Startup", "OK");
php_info_print_table_row(2, "Shared memory model", zend_accel_get_shared_model());
- snprintf(buf, sizeof(buf), "%pd", (zend_ulong)ZCSG(hits));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, (zend_ulong)ZCSG(hits));
php_info_print_table_row(2, "Cache hits", buf);
- snprintf(buf, sizeof(buf), "%pd", ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZSMMG(memory_exhausted)?ZCSG(misses):ZCSG(misses)-ZCSG(blacklist_misses));
php_info_print_table_row(2, "Cache misses", buf);
snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCG(accel_directives).memory_consumption-zend_shared_alloc_get_free_memory()-ZSMMG(wasted_shared_memory));
php_info_print_table_row(2, "Used memory", buf);
- snprintf(buf, sizeof(buf), "%pd", zend_shared_alloc_get_free_memory());
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, zend_shared_alloc_get_free_memory());
php_info_print_table_row(2, "Free memory", buf);
- snprintf(buf, sizeof(buf), "%pd", ZSMMG(wasted_shared_memory));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZSMMG(wasted_shared_memory));
php_info_print_table_row(2, "Wasted memory", buf);
if (ZCSG(interned_strings_start) && ZCSG(interned_strings_end) && ZCSG(interned_strings_top)) {
- snprintf(buf, sizeof(buf), "%pd", ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(interned_strings_top) - ZCSG(interned_strings_start));
php_info_print_table_row(2, "Interned Strings Used memory", buf);
- snprintf(buf, sizeof(buf), "%pd", ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(interned_strings_end) - ZCSG(interned_strings_top));
php_info_print_table_row(2, "Interned Strings Free memory", buf);
}
- snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_direct_entries);
+ snprintf(buf, sizeof(buf), "%d", ZCSG(hash).num_direct_entries);
php_info_print_table_row(2, "Cached scripts", buf);
- snprintf(buf, sizeof(buf), "%ld", ZCSG(hash).num_entries);
+ snprintf(buf, sizeof(buf), "%d", ZCSG(hash).num_entries);
php_info_print_table_row(2, "Cached keys", buf);
- snprintf(buf, sizeof(buf), "%pd", ZCSG(hash).max_num_entries);
+ snprintf(buf, sizeof(buf), "%d", ZCSG(hash).max_num_entries);
php_info_print_table_row(2, "Max keys", buf);
- snprintf(buf, sizeof(buf), "%pd", ZCSG(oom_restarts));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(oom_restarts));
php_info_print_table_row(2, "OOM restarts", buf);
- snprintf(buf, sizeof(buf), "%pd", ZCSG(hash_restarts));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(hash_restarts));
php_info_print_table_row(2, "Hash keys restarts", buf);
- snprintf(buf, sizeof(buf), "%pd", ZCSG(manual_restarts));
+ snprintf(buf, sizeof(buf), ZEND_LONG_FMT, ZCSG(manual_restarts));
php_info_print_table_row(2, "Manual restarts", buf);
}
}
diff --git a/ext/opcache/zend_shared_alloc.c b/ext/opcache/zend_shared_alloc.c
index ff42c4cf0b..28cdc44097 100644
--- a/ext/opcache/zend_shared_alloc.c
+++ b/ext/opcache/zend_shared_alloc.c
@@ -99,7 +99,7 @@ void zend_shared_alloc_create_lock(char *lockfile_path)
static void no_memory_bailout(size_t allocate_size, char *error)
{
- zend_accel_error(ACCEL_LOG_FATAL, "Unable to allocate shared memory segment of %ld bytes: %s: %s (%d)", allocate_size, error?error:"unknown", strerror(errno), errno );
+ zend_accel_error(ACCEL_LOG_FATAL, "Unable to allocate shared memory segment of %zu bytes: %s: %s (%d)", allocate_size, error?error:"unknown", strerror(errno), errno );
}
static void copy_shared_segments(void *to, void *from, int count, int size)
@@ -299,7 +299,7 @@ static size_t zend_shared_alloc_get_largest_free_block(void)
#define MIN_FREE_MEMORY 64*1024
#define SHARED_ALLOC_FAILED() do { \
- zend_accel_error(ACCEL_LOG_WARNING, "Not enough free shared space to allocate %pd bytes (%pd bytes free)", (zend_long)size, (zend_long)ZSMMG(shared_free)); \
+ zend_accel_error(ACCEL_LOG_WARNING, "Not enough free shared space to allocate %zd bytes (%zd bytes free)", (size_t)size, (size_t)ZSMMG(shared_free)); \
if (zend_shared_alloc_get_largest_free_block() < MIN_FREE_MEMORY) { \
ZSMMG(memory_exhausted) = 1; \
} \
diff --git a/ext/openssl/openssl.c b/ext/openssl/openssl.c
index b462d0e66c..72efb44f61 100644
--- a/ext/openssl/openssl.c
+++ b/ext/openssl/openssl.c
@@ -5637,7 +5637,7 @@ static int php_openssl_validate_iv(char **piv, size_t *piv_len, size_t iv_requir
if (mode->is_aead) {
if (EVP_CIPHER_CTX_ctrl(cipher_ctx, mode->aead_ivlen_flag, *piv_len, NULL) != 1) {
php_error_docref(NULL, E_WARNING,
- "Setting of IV length for AEAD mode failed, the expected length is %d bytes",
+ "Setting of IV length for AEAD mode failed, the expected length is %zd bytes",
iv_required_len);
return FAILURE;
}
diff --git a/ext/pdo/pdo.c b/ext/pdo/pdo.c
index e0fc9d74f2..c6b9ebdcdc 100644
--- a/ext/pdo/pdo.c
+++ b/ext/pdo/pdo.c
@@ -159,7 +159,7 @@ static PHP_GINIT_FUNCTION(pdo)
PDO_API int php_pdo_register_driver(pdo_driver_t *driver) /* {{{ */
{
if (driver->api_version != PDO_DRIVER_API) {
- zend_error(E_ERROR, "PDO: driver %s requires PDO API version %pd; this is PDO version %d",
+ zend_error(E_ERROR, "PDO: driver %s requires PDO API version " ZEND_ULONG_FMT "; this is PDO version %d",
driver->driver_name, driver->api_version, PDO_DRIVER_API);
return FAILURE;
}
diff --git a/ext/pdo/pdo_dbh.c b/ext/pdo/pdo_dbh.c
index 624281c18b..ffb1b6ef03 100644
--- a/ext/pdo/pdo_dbh.c
+++ b/ext/pdo/pdo_dbh.c
@@ -141,7 +141,7 @@ PDO_API void pdo_handle_error(pdo_dbh_t *dbh, pdo_stmt_t *stmt) /* {{{ */
}
if (supp) {
- message = strpprintf(0, "SQLSTATE[%s]: %s: %ld %s", *pdo_err, msg, native_code, supp);
+ message = strpprintf(0, "SQLSTATE[%s]: %s: " ZEND_LONG_FMT " %s", *pdo_err, msg, native_code, supp);
} else {
message = strpprintf(0, "SQLSTATE[%s]: %s", *pdo_err, msg);
}
diff --git a/ext/pdo/pdo_stmt.c b/ext/pdo/pdo_stmt.c
index c2f3c13399..bd8a054718 100644
--- a/ext/pdo/pdo_stmt.c
+++ b/ext/pdo/pdo_stmt.c
@@ -2123,10 +2123,10 @@ static PHP_METHOD(PDOStatement, debugDumpParams)
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, "Key: Position #" ZEND_ULONG_FMT ":\n", num);
}
- php_stream_printf(out, "paramno=%pd\nname=[%zd] \"%.*s\"\nis_param=%d\nparam_type=%d\n",
+ php_stream_printf(out, "paramno=" ZEND_LONG_FMT "\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,
diff --git a/ext/pdo_pgsql/pgsql_driver.c b/ext/pdo_pgsql/pgsql_driver.c
index 3f92525506..a8229fe88e 100644
--- a/ext/pdo_pgsql/pgsql_driver.c
+++ b/ext/pdo_pgsql/pgsql_driver.c
@@ -1218,13 +1218,13 @@ static int pdo_pgsql_handle_factory(pdo_dbh_t *dbh, zval *driver_options) /* {{{
/* support both full connection string & connection string + login and/or password */
if (tmp_user && tmp_pass) {
- spprintf(&conn_str, 0, "%s user='%s' password='%s' connect_timeout=%pd", (char *) dbh->data_source, ZSTR_VAL(tmp_user), ZSTR_VAL(tmp_pass), connect_timeout);
+ spprintf(&conn_str, 0, "%s user='%s' password='%s' connect_timeout=" ZEND_LONG_FMT, (char *) dbh->data_source, ZSTR_VAL(tmp_user), ZSTR_VAL(tmp_pass), connect_timeout);
} else if (tmp_user) {
- spprintf(&conn_str, 0, "%s user='%s' connect_timeout=%pd", (char *) dbh->data_source, ZSTR_VAL(tmp_user), connect_timeout);
+ spprintf(&conn_str, 0, "%s user='%s' connect_timeout=" ZEND_LONG_FMT, (char *) dbh->data_source, ZSTR_VAL(tmp_user), connect_timeout);
} else if (tmp_pass) {
- spprintf(&conn_str, 0, "%s password='%s' connect_timeout=%pd", (char *) dbh->data_source, ZSTR_VAL(tmp_pass), connect_timeout);
+ spprintf(&conn_str, 0, "%s password='%s' connect_timeout=" ZEND_LONG_FMT, (char *) dbh->data_source, ZSTR_VAL(tmp_pass), connect_timeout);
} else {
- spprintf(&conn_str, 0, "%s connect_timeout=%pd", (char *) dbh->data_source, connect_timeout);
+ spprintf(&conn_str, 0, "%s connect_timeout=" ZEND_LONG_FMT, (char *) dbh->data_source, connect_timeout);
}
H->server = PQconnectdb(conn_str);
diff --git a/ext/pdo_pgsql/pgsql_statement.c b/ext/pdo_pgsql/pgsql_statement.c
index ee06cfc439..6134a733ca 100644
--- a/ext/pdo_pgsql/pgsql_statement.c
+++ b/ext/pdo_pgsql/pgsql_statement.c
@@ -424,8 +424,8 @@ static int pgsql_stmt_fetch(pdo_stmt_t *stmt,
case PDO_FETCH_ORI_PRIOR: spprintf(&ori_str, 0, "BACKWARD"); break;
case PDO_FETCH_ORI_FIRST: spprintf(&ori_str, 0, "FIRST"); break;
case PDO_FETCH_ORI_LAST: spprintf(&ori_str, 0, "LAST"); break;
- case PDO_FETCH_ORI_ABS: spprintf(&ori_str, 0, "ABSOLUTE %pd", offset); break;
- case PDO_FETCH_ORI_REL: spprintf(&ori_str, 0, "RELATIVE %pd", offset); break;
+ case PDO_FETCH_ORI_ABS: spprintf(&ori_str, 0, "ABSOLUTE " ZEND_LONG_FMT, offset); break;
+ case PDO_FETCH_ORI_REL: spprintf(&ori_str, 0, "RELATIVE " ZEND_LONG_FMT, offset); break;
default:
return 0;
}
diff --git a/ext/pgsql/pgsql.c b/ext/pgsql/pgsql.c
index 16a84ffcd8..b567c3c8a5 100644
--- a/ext/pgsql/pgsql.c
+++ b/ext/pgsql/pgsql.c
@@ -1343,12 +1343,12 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
if (PGG(max_links) != -1 && PGG(num_links) >= PGG(max_links)) {
php_error_docref(NULL, E_WARNING,
- "Cannot create new link. Too many open links (%pd)", PGG(num_links));
+ "Cannot create new link. Too many open links (" ZEND_LONG_FMT ")", PGG(num_links));
goto err;
}
if (PGG(max_persistent) != -1 && PGG(num_persistent) >= PGG(max_persistent)) {
php_error_docref(NULL, E_WARNING,
- "Cannot create new link. Too many open persistent links (%pd)", PGG(num_persistent));
+ "Cannot create new link. Too many open persistent links (" ZEND_LONG_FMT ")", PGG(num_persistent));
goto err;
}
@@ -1441,7 +1441,7 @@ static void php_pgsql_do_connect(INTERNAL_FUNCTION_PARAMETERS, int persistent)
}
}
if (PGG(max_links) != -1 && PGG(num_links) >= PGG(max_links)) {
- php_error_docref(NULL, E_WARNING, "Cannot create new link. Too many open links (%pd)", PGG(num_links));
+ php_error_docref(NULL, E_WARNING, "Cannot create new link. Too many open links (" ZEND_LONG_FMT ")", PGG(num_links));
goto err;
}
@@ -2681,7 +2681,7 @@ PHP_FUNCTION(pg_fetch_result)
}
} else {
if (row < 0 || row >= PQntuples(pgsql_result)) {
- php_error_docref(NULL, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
+ php_error_docref(NULL, E_WARNING, "Unable to jump to row " ZEND_LONG_FMT " on PostgreSQL result index " ZEND_LONG_FMT,
row, Z_LVAL_P(result));
RETURN_FALSE;
}
@@ -2772,7 +2772,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
if (use_row) {
if (row < 0 || row >= PQntuples(pgsql_result)) {
- php_error_docref(NULL, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
+ php_error_docref(NULL, E_WARNING, "Unable to jump to row " ZEND_LONG_FMT " on PostgreSQL result index " ZEND_LONG_FMT,
row, Z_LVAL_P(result));
RETURN_FALSE;
}
@@ -2858,7 +2858,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
fcc.object = Z_OBJ_P(return_value);
if (zend_call_function(&fci, &fcc) == FAILURE) {
- zend_throw_exception_ex(zend_ce_exception, 0, "Could not execute %s::%s()", ce->name, ce->constructor->common.function_name);
+ zend_throw_exception_ex(zend_ce_exception, 0, "Could not execute %s::%s()", ZSTR_VAL(ce->name), ZSTR_VAL(ce->constructor->common.function_name));
} else {
zval_ptr_dtor(&retval);
}
@@ -2866,7 +2866,7 @@ static void php_pgsql_fetch_hash(INTERNAL_FUNCTION_PARAMETERS, zend_long result_
efree(fci.params);
}
} else if (ctor_params) {
- zend_throw_exception_ex(zend_ce_exception, 0, "Class %s does not have a constructor hence you cannot use ctor_params", ce->name);
+ zend_throw_exception_ex(zend_ce_exception, 0, "Class %s does not have a constructor hence you cannot use ctor_params", ZSTR_VAL(ce->name));
}
}
}
@@ -2964,7 +2964,7 @@ PHP_FUNCTION(pg_fetch_all_columns)
num_fields = PQnfields(pgsql_result);
if (colno >= (zend_long)num_fields || colno < 0) {
- php_error_docref(NULL, E_WARNING, "Invalid column number '%pd'", colno);
+ php_error_docref(NULL, E_WARNING, "Invalid column number '" ZEND_LONG_FMT "'", colno);
RETURN_FALSE;
}
@@ -3048,7 +3048,7 @@ static void php_pgsql_data_info(INTERNAL_FUNCTION_PARAMETERS, int entry_type)
}
} else {
if (row < 0 || row >= PQntuples(pgsql_result)) {
- php_error_docref(NULL, E_WARNING, "Unable to jump to row %pd on PostgreSQL result index %pd",
+ php_error_docref(NULL, E_WARNING, "Unable to jump to row " ZEND_LONG_FMT " on PostgreSQL result index " ZEND_LONG_FMT,
row, Z_LVAL_P(result));
RETURN_FALSE;
}
@@ -3582,11 +3582,11 @@ PHP_FUNCTION(pg_lo_write)
if (argc > 2) {
if (z_len > (zend_long)str_len) {
- php_error_docref(NULL, E_WARNING, "Cannot write more than buffer size %d. Tried to write %pd", str_len, z_len);
+ php_error_docref(NULL, E_WARNING, "Cannot write more than buffer size %d. Tried to write " ZEND_LONG_FMT, str_len, z_len);
RETURN_FALSE;
}
if (z_len < 0) {
- php_error_docref(NULL, E_WARNING, "Buffer size must be larger than 0, but %pd was specified", z_len);
+ php_error_docref(NULL, E_WARNING, "Buffer size must be larger than 0, but " ZEND_LONG_FMT " was specified", z_len);
RETURN_FALSE;
}
len = z_len;
diff --git a/ext/phar/func_interceptors.c b/ext/phar/func_interceptors.c
index 54610939dd..a390a1fa5c 100644
--- a/ext/phar/func_interceptors.c
+++ b/ext/phar/func_interceptors.c
@@ -200,7 +200,7 @@ phar_it:
}
if (offset > 0 && php_stream_seek(stream, offset, SEEK_SET) < 0) {
- php_error_docref(NULL, E_WARNING, "Failed to seek to position %pd in the stream", offset);
+ php_error_docref(NULL, E_WARNING, "Failed to seek to position " ZEND_LONG_FMT " in the stream", offset);
php_stream_close(stream);
RETURN_FALSE;
}
diff --git a/ext/phar/phar_object.c b/ext/phar/phar_object.c
index 75c2487ffd..a287dc996b 100644
--- a/ext/phar/phar_object.c
+++ b/ext/phar/phar_object.c
@@ -1404,7 +1404,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
if (!value) {
/* failure in get_current_data */
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned no value", ZSTR_VAL(ce->name));
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned no value", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
@@ -1415,7 +1415,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
php_stream_from_zval_no_verify(fp, value);
if (!fp) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %v returned an invalid stream handle", ZSTR_VAL(ce->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %s returned an invalid stream handle", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
@@ -1429,7 +1429,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
if (Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
@@ -1439,7 +1439,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
save = str_key;
zval_dtor(&key);
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
@@ -1453,7 +1453,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
spl_filesystem_object *intern = (spl_filesystem_object*)((char*)Z_OBJ_P(value) - Z_OBJ_P(value)->handlers->offset);
if (!base_len) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %v returns an SplFileInfo object, so base directory must be specified", ZSTR_VAL(ce->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Iterator %s returns an SplFileInfo object, so base directory must be specified", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
@@ -1497,7 +1497,7 @@ static int phar_build(zend_object_iterator *iter, void *puser) /* {{{ */
}
/* fall-through */
default:
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid value (must return a string)", ZSTR_VAL(ce->name));
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid value (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
@@ -1537,7 +1537,7 @@ phar_spl_fileinfo:
}
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that is not in the base directory \"%s\"", ZSTR_VAL(ce->name), fname, base);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned a path \"%s\" that is not in the base directory \"%s\"", ZSTR_VAL(ce->name), fname, base);
if (save) {
efree(save);
@@ -1557,7 +1557,7 @@ phar_spl_fileinfo:
if (Z_TYPE(key) != IS_STRING) {
zval_dtor(&key);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
@@ -1567,13 +1567,13 @@ phar_spl_fileinfo:
save = str_key;
zval_dtor(&key);
} else {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned an invalid key (must return a string)", ZSTR_VAL(ce->name));
return ZEND_HASH_APPLY_STOP;
}
}
if (php_check_open_basedir(fname)) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a path \"%s\" that open_basedir prevents opening", ZSTR_VAL(ce->name), fname);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned a path \"%s\" that open_basedir prevents opening", ZSTR_VAL(ce->name), fname);
if (save) {
efree(save);
@@ -1590,7 +1590,7 @@ phar_spl_fileinfo:
fp = php_stream_open_wrapper(fname, "rb", STREAM_MUST_SEEK|0, &opened);
if (!fp) {
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %v returned a file that could not be opened \"%s\"", ZSTR_VAL(ce->name), fname);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Iterator %s returned a file that could not be opened \"%s\"", ZSTR_VAL(ce->name), fname);
if (save) {
efree(save);
@@ -3525,7 +3525,7 @@ PHP_METHOD(Phar, offsetGet)
}
if (fname_len >= sizeof(".phar")-1 && !memcmp(fname, ".phar", sizeof(".phar")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot directly get any files or directories in magic \".phar\" directory", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot directly get any files or directories in magic \".phar\" directory");
return;
}
@@ -3552,7 +3552,7 @@ static void phar_add_file(phar_archive_data **pphar, char *filename, int filenam
php_stream *contents_file;
if (filename_len >= sizeof(".phar")-1 && !memcmp(filename, ".phar", sizeof(".phar")-1) && (filename[5] == '/' || filename[5] == '\\' || filename[5] == '\0')) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot create any files in magic \".phar\" directory", (*pphar)->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot create any files in magic \".phar\" directory");
return;
}
@@ -3669,7 +3669,7 @@ PHP_METHOD(Phar, offsetSet)
}
if (fname_len >= sizeof(".phar")-1 && !memcmp(fname, ".phar", sizeof(".phar")-1)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set any files or directories in magic \".phar\" directory", phar_obj->archive->fname);
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "Cannot set any files or directories in magic \".phar\" directory");
return;
}
diff --git a/ext/pspell/pspell.c b/ext/pspell/pspell.c
index 58d7f4a4c9..7db0074929 100644
--- a/ext/pspell/pspell.c
+++ b/ext/pspell/pspell.c
@@ -230,7 +230,7 @@ static void php_pspell_close_config(zend_resource *rsrc)
#define PSPELL_FETCH_CONFIG do { \
zval *res = zend_hash_index_find(&EG(regular_list), conf); \
if (res == NULL || Z_RES_P(res)->type != le_pspell_config) { \
- php_error_docref(NULL, E_WARNING, "%ld is not a PSPELL config index", conf); \
+ php_error_docref(NULL, E_WARNING, ZEND_LONG_FMT " is not a PSPELL config index", conf); \
RETURN_FALSE; \
} \
config = (PspellConfig *)Z_RES_P(res)->ptr; \
@@ -239,7 +239,7 @@ static void php_pspell_close_config(zend_resource *rsrc)
#define PSPELL_FETCH_MANAGER do { \
zval *res = zend_hash_index_find(&EG(regular_list), scin); \
if (res == NULL || Z_RES_P(res)->type != le_pspell) { \
- php_error_docref(NULL, E_WARNING, "%ld is not a PSPELL result index", scin); \
+ php_error_docref(NULL, E_WARNING, ZEND_LONG_FMT " is not a PSPELL result index", scin); \
RETURN_FALSE; \
} \
manager = (PspellManager *)Z_RES_P(res)->ptr; \
@@ -808,7 +808,7 @@ static PHP_FUNCTION(pspell_config_ignore)
PSPELL_FETCH_CONFIG;
- snprintf(ignore_str, sizeof(ignore_str), "%ld", ignore);
+ snprintf(ignore_str, sizeof(ignore_str), ZEND_LONG_FMT, ignore);
pspell_config_replace(config, "ignore", ignore_str);
RETURN_TRUE;
diff --git a/ext/session/php_session.h b/ext/session/php_session.h
index a3b4de82f0..9b4d40bac9 100644
--- a/ext/session/php_session.h
+++ b/ext/session/php_session.h
@@ -300,7 +300,7 @@ PHPAPI void php_session_reset_id(void);
ZEND_HASH_FOREACH_KEY(_ht, num_key, key) { \
if (key == NULL) { \
php_error_docref(NULL, E_NOTICE, \
- "Skipping numeric key %pd", num_key); \
+ "Skipping numeric key " ZEND_ULONG_FMT, num_key); \
continue; \
} \
if ((struc = php_get_session_var(key))) { \
diff --git a/ext/simplexml/simplexml.c b/ext/simplexml/simplexml.c
index 8a1ef4915f..fc4d059aa1 100644
--- a/ext/simplexml/simplexml.c
+++ b/ext/simplexml/simplexml.c
@@ -323,7 +323,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
}
if (sxe->iter.type == SXE_ITER_NONE) {
if (member && Z_LVAL_P(member) > 0) {
- php_error_docref(NULL, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_LVAL_P(member));
+ php_error_docref(NULL, E_WARNING, "Cannot add element %s number " ZEND_LONG_FMT " when only 0 such elements exist", mynode->name, Z_LVAL_P(member));
}
} else if (member) {
node = sxe_get_element_by_offset(sxe, Z_LVAL_P(member), node, &cnt);
@@ -334,7 +334,7 @@ static zval *sxe_prop_dim_read(zval *object, zval *member, zend_bool elements, z
_node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix);
} else if (type == BP_VAR_W || type == BP_VAR_RW) {
if (member && cnt < Z_LVAL_P(member)) {
- php_error_docref(NULL, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_LVAL_P(member), cnt);
+ php_error_docref(NULL, E_WARNING, "Cannot add element %s number " ZEND_LONG_FMT " when only " ZEND_LONG_FMT " such elements exist", mynode->name, Z_LVAL_P(member), cnt);
}
node = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, NULL);
_node_as_zval(sxe, node, rv, SXE_ITER_NONE, NULL, sxe->iter.nsprefix, sxe->iter.isprefix);
@@ -579,7 +579,7 @@ static int sxe_prop_dim_write(zval *object, zval *member, zval *value, zend_bool
newnode = node;
++counter;
if (member && Z_LVAL_P(member) > 0) {
- php_error_docref(NULL, E_WARNING, "Cannot add element %s number %pd when only 0 such elements exist", mynode->name, Z_LVAL_P(member));
+ php_error_docref(NULL, E_WARNING, "Cannot add element %s number " ZEND_LONG_FMT " when only 0 such elements exist", mynode->name, Z_LVAL_P(member));
retval = FAILURE;
}
} else if (member) {
@@ -627,14 +627,14 @@ next_iter:
}
} else if (!member || Z_TYPE_P(member) == IS_LONG) {
if (member && cnt < Z_LVAL_P(member)) {
- php_error_docref(NULL, E_WARNING, "Cannot add element %s number %pd when only %pd such elements exist", mynode->name, Z_LVAL_P(member), cnt);
+ php_error_docref(NULL, E_WARNING, "Cannot add element %s number " ZEND_LONG_FMT " when only " ZEND_LONG_FMT " such elements exist", mynode->name, Z_LVAL_P(member), cnt);
retval = FAILURE;
}
newnode = xmlNewTextChild(mynode->parent, mynode->ns, mynode->name, value ? (xmlChar *)Z_STRVAL_P(value) : NULL);
}
} else if (attribs) {
if (Z_TYPE_P(member) == IS_LONG) {
- php_error_docref(NULL, E_WARNING, "Cannot change attribute number %pd when only %d attributes exist", Z_LVAL_P(member), nodendx);
+ php_error_docref(NULL, E_WARNING, "Cannot change attribute number " ZEND_LONG_FMT " when only %d attributes exist", Z_LVAL_P(member), nodendx);
retval = FAILURE;
} else {
newnode = (xmlNodePtr)xmlNewProp(node, (xmlChar *)Z_STRVAL_P(member), value ? (xmlChar *)Z_STRVAL_P(value) : NULL);
diff --git a/ext/snmp/snmp.c b/ext/snmp/snmp.c
index 38d82db670..7c4faa6cf3 100644
--- a/ext/snmp/snmp.c
+++ b/ext/snmp/snmp.c
@@ -1752,7 +1752,7 @@ PHP_FUNCTION(snmp_set_valueretrieval)
SNMP_G(valueretrieval) = method;
RETURN_TRUE;
} else {
- php_error_docref(NULL, E_WARNING, "Unknown SNMP value retrieval method '%pd'", method);
+ php_error_docref(NULL, E_WARNING, "Unknown SNMP value retrieval method '" ZEND_LONG_FMT "'", method);
RETURN_FALSE;
}
}
@@ -2183,7 +2183,7 @@ static int php_snmp_write_max_oids(php_snmp_object *snmp_object, zval *newval)
if (Z_LVAL_P(newval) > 0) {
snmp_object->max_oids = Z_LVAL_P(newval);
} else {
- php_error_docref(NULL, E_WARNING, "max_oids should be positive integer or NULL, got %pd", Z_LVAL_P(newval));
+ php_error_docref(NULL, E_WARNING, "max_oids should be positive integer or NULL, got " ZEND_LONG_FMT, Z_LVAL_P(newval));
}
if (newval == &ztmp) {
@@ -2210,7 +2210,7 @@ static int php_snmp_write_valueretrieval(php_snmp_object *snmp_object, zval *new
if (Z_LVAL_P(newval) >= 0 && Z_LVAL_P(newval) <= (SNMP_VALUE_LIBRARY|SNMP_VALUE_PLAIN|SNMP_VALUE_OBJECT)) {
snmp_object->valueretrieval = Z_LVAL_P(newval);
} else {
- php_error_docref(NULL, E_WARNING, "Unknown SNMP value retrieval method '%pd'", Z_LVAL_P(newval));
+ php_error_docref(NULL, E_WARNING, "Unknown SNMP value retrieval method '" ZEND_LONG_FMT "'", Z_LVAL_P(newval));
ret = FAILURE;
}
@@ -2260,7 +2260,7 @@ static int php_snmp_write_oid_output_format(php_snmp_object *snmp_object, zval *
snmp_object->oid_output_format = Z_LVAL_P(newval);
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown SNMP output print format '%pd'", Z_LVAL_P(newval));
+ php_error_docref(NULL, E_WARNING, "Unknown SNMP output print format '" ZEND_LONG_FMT "'", Z_LVAL_P(newval));
ret = FAILURE;
break;
}
diff --git a/ext/soap/php_encoding.c b/ext/soap/php_encoding.c
index 803a5cd596..6080444cf8 100644
--- a/ext/soap/php_encoding.c
+++ b/ext/soap/php_encoding.c
@@ -2879,7 +2879,7 @@ static xmlNodePtr to_xml_datetime_ex(encodeTypePtr type, zval *data, char *forma
ta = php_localtime_r(&timestamp, &tmbuf);
/*ta = php_gmtime_r(&timestamp, &tmbuf);*/
if (!ta) {
- soap_error1(E_ERROR, "Encoding: Invalid timestamp %pd", Z_LVAL_P(data));
+ soap_error1(E_ERROR, "Encoding: Invalid timestamp " ZEND_LONG_FMT, Z_LVAL_P(data));
}
buf = (char *) emalloc(buf_len);
diff --git a/ext/soap/php_http.c b/ext/soap/php_http.c
index 7c9183613c..26221962d6 100644
--- a/ext/soap/php_http.c
+++ b/ext/soap/php_http.c
@@ -651,7 +651,7 @@ try_again:
if ((tmp = zend_hash_str_find(Z_ARRVAL_P(digest), "nc", sizeof("nc")-1)) != NULL &&
Z_TYPE_P(tmp) == IS_LONG) {
Z_LVAL_P(tmp)++;
- snprintf(nc, sizeof(nc), "%08ld", Z_LVAL_P(tmp));
+ snprintf(nc, sizeof(nc), "%08" ZEND_LONG_FMT_SPEC, Z_LVAL_P(tmp));
} else {
add_assoc_long(digest, "nc", 1);
strcpy(nc, "00000001");
diff --git a/ext/soap/soap.c b/ext/soap/soap.c
index c842ce5119..885116e2e9 100644
--- a/ext/soap/soap.c
+++ b/ext/soap/soap.c
@@ -970,7 +970,7 @@ PHP_METHOD(SoapFault, __toString)
convert_to_long(line);
convert_to_string(&trace);
- str = strpprintf(0, "SoapFault exception: [%s] %s in %s:%pd\nStack trace:\n%s",
+ str = strpprintf(0, "SoapFault exception: [%s] %s in %s:" ZEND_LONG_FMT "\nStack trace:\n%s",
Z_STRVAL_P(faultcode), Z_STRVAL_P(faultstring), Z_STRVAL_P(file), Z_LVAL_P(line),
Z_STRLEN(trace) ? Z_STRVAL(trace) : "#0 {main}\n");
@@ -1273,7 +1273,7 @@ PHP_METHOD(SoapServer, setPersistence)
value == SOAP_PERSISTENCE_REQUEST) {
service->soap_class.persistence = value;
} else {
- php_error_docref(NULL, E_WARNING, "Tried to set persistence with bogus value (%pd)", value);
+ php_error_docref(NULL, E_WARNING, "Tried to set persistence with bogus value (" ZEND_LONG_FMT ")", value);
return;
}
} else {
diff --git a/ext/sockets/conversions.c b/ext/sockets/conversions.c
index f2621f65d0..892442a88f 100644
--- a/ext/sockets/conversions.c
+++ b/ext/sockets/conversions.c
@@ -656,7 +656,7 @@ static void from_zval_write_sun_path(const zval *path, char *sockaddr_un_c, ser_
}
if (ZSTR_LEN(path_str) >= sizeof(saddr->sun_path)) {
do_from_zval_err(ctx, "the path is too long, the maximum permitted "
- "length is %ld", sizeof(saddr->sun_path) - 1);
+ "length is %zd", sizeof(saddr->sun_path) - 1);
return;
}
@@ -965,7 +965,7 @@ static void to_zval_read_cmsg_data(const char *cmsghdr_c, zval *zv, res_context
}
if (CMSG_LEN(entry->size) > cmsg->cmsg_len) {
do_to_zval_err(ctx, "the cmsghdr structure is unexpectedly small; "
- "expected a length of at least %pd, but got %pd",
+ "expected a length of at least " ZEND_LONG_FMT ", but got " ZEND_LONG_FMT,
(zend_long)CMSG_LEN(entry->size), (zend_long)cmsg->cmsg_len);
return;
}
@@ -1062,8 +1062,8 @@ static void from_zval_write_msghdr_buffer_size(const zval *elem, char *msghdr_c,
}
if (lval < 0 || lval > MAX_USER_BUFF_SIZE) {
- do_from_zval_err(ctx, "the buffer size must be between 1 and %pd; "
- "given %pd", (zend_long)MAX_USER_BUFF_SIZE, lval);
+ do_from_zval_err(ctx, "the buffer size must be between 1 and " ZEND_LONG_FMT "; "
+ "given " ZEND_LONG_FMT, (zend_long)MAX_USER_BUFF_SIZE, lval);
return;
}
@@ -1238,7 +1238,7 @@ static void from_zval_write_ifindex(const zval *zv, char *uinteger, ser_context
if (Z_TYPE_P(zv) == IS_LONG) {
if (Z_LVAL_P(zv) < 0 || Z_LVAL_P(zv) > UINT_MAX) { /* allow 0 (unspecified interface) */
do_from_zval_err(ctx, "the interface index cannot be negative or "
- "larger than %u; given %pd", UINT_MAX, Z_LVAL_P(zv));
+ "larger than %u; given " ZEND_LONG_FMT, UINT_MAX, Z_LVAL_P(zv));
} else {
ret = (unsigned)Z_LVAL_P(zv);
}
@@ -1400,7 +1400,7 @@ void to_zval_read_fd_array(const char *data, zval *zv, res_context *ctx)
if (*cmsg_len < data_offset) {
do_to_zval_err(ctx, "length of cmsg is smaller than its data member "
- "offset (%pd vs %pd)", (zend_long)*cmsg_len, (zend_long)data_offset);
+ "offset (" ZEND_LONG_FMT " vs " ZEND_LONG_FMT ")", (zend_long)*cmsg_len, (zend_long)data_offset);
return;
}
num_elems = (*cmsg_len - data_offset) / sizeof(int);
diff --git a/ext/sockets/multicast.c b/ext/sockets/multicast.c
index 6d37bfb1dd..75984ec323 100644
--- a/ext/sockets/multicast.c
+++ b/ext/sockets/multicast.c
@@ -93,7 +93,7 @@ static int php_get_if_index_from_zval(zval *val, unsigned *out)
if (Z_LVAL_P(val) < 0 || Z_LVAL_P(val) > UINT_MAX) {
php_error_docref(NULL, E_WARNING,
"the interface index cannot be negative or larger than %u;"
- " given %pd", UINT_MAX, Z_LVAL_P(val));
+ " given " ZEND_LONG_FMT, UINT_MAX, Z_LVAL_P(val));
ret = FAILURE;
} else {
*out = Z_LVAL_P(val);
diff --git a/ext/sockets/sendrecvmsg.c b/ext/sockets/sendrecvmsg.c
index 7471ad143a..72d8cfc47e 100644
--- a/ext/sockets/sendrecvmsg.c
+++ b/ext/sockets/sendrecvmsg.c
@@ -71,7 +71,7 @@ inline ssize_t sendmsg(int sockfd, const struct msghdr *msg, int flags)
#define LONG_CHECK_VALID_INT(l) \
do { \
if ((l) < INT_MIN && (l) > INT_MAX) { \
- php_error_docref0(NULL, E_WARNING, "The value %pd does not fit inside " \
+ php_error_docref0(NULL, E_WARNING, "The value " ZEND_LONG_FMT " does not fit inside " \
"the boundaries of a native integer", (l)); \
return; \
} \
@@ -299,7 +299,7 @@ PHP_FUNCTION(socket_cmsg_space)
entry = get_ancillary_reg_entry(level, type);
if (entry == NULL) {
- php_error_docref0(NULL, E_WARNING, "The pair level %pd/type %pd is "
+ php_error_docref0(NULL, E_WARNING, "The pair level " ZEND_LONG_FMT "/type " ZEND_LONG_FMT " is "
"not supported by PHP", level, type);
return;
}
@@ -308,7 +308,7 @@ PHP_FUNCTION(socket_cmsg_space)
(zend_long)CMSG_SPACE(0) - 15L) / entry->var_el_size) {
/* the -15 is to account for any padding CMSG_SPACE may add after the data */
php_error_docref0(NULL, E_WARNING, "The value for the "
- "third argument (%pd) is too large", n);
+ "third argument (" ZEND_LONG_FMT ") is too large", n);
return;
}
diff --git a/ext/sockets/sockets.c b/ext/sockets/sockets.c
index 63674c50d7..c289b0f9a3 100644
--- a/ext/sockets/sockets.c
+++ b/ext/sockets/sockets.c
@@ -1377,12 +1377,12 @@ PHP_FUNCTION(socket_create)
&& arg1 != AF_INET6
#endif
&& arg1 != AF_INET) {
- php_error_docref(NULL, E_WARNING, "invalid socket domain [%pd] specified for argument 1, assuming AF_INET", arg1);
+ php_error_docref(NULL, E_WARNING, "invalid socket domain [" ZEND_LONG_FMT "] specified for argument 1, assuming AF_INET", arg1);
arg1 = AF_INET;
}
if (arg2 > 10) {
- php_error_docref(NULL, E_WARNING, "invalid socket type [%pd] specified for argument 2, assuming SOCK_STREAM", arg2);
+ php_error_docref(NULL, E_WARNING, "invalid socket type [" ZEND_LONG_FMT "] specified for argument 2, assuming SOCK_STREAM", arg2);
arg2 = SOCK_STREAM;
}
@@ -2153,12 +2153,12 @@ PHP_FUNCTION(socket_create_pair)
&& domain != AF_INET6
#endif
&& domain != AF_UNIX) {
- php_error_docref(NULL, E_WARNING, "invalid socket domain [%pd] specified for argument 1, assuming AF_INET", domain);
+ php_error_docref(NULL, E_WARNING, "invalid socket domain [" ZEND_LONG_FMT "] specified for argument 1, assuming AF_INET", domain);
domain = AF_INET;
}
if (type > 10) {
- php_error_docref(NULL, E_WARNING, "invalid socket type [%pd] specified for argument 2, assuming SOCK_STREAM", type);
+ php_error_docref(NULL, E_WARNING, "invalid socket type [" ZEND_LONG_FMT "] specified for argument 2, assuming SOCK_STREAM", type);
type = SOCK_STREAM;
}
diff --git a/ext/spl/php_spl.c b/ext/spl/php_spl.c
index 87fb2ae37b..5bbb99f2c5 100644
--- a/ext/spl/php_spl.c
+++ b/ext/spl/php_spl.c
@@ -759,7 +759,7 @@ PHPAPI zend_string *php_spl_object_hash(zval *obj) /* {{{*/
hash_handle = SPL_G(hash_mask_handle)^(intptr_t)Z_OBJ_HANDLE_P(obj);
hash_handlers = SPL_G(hash_mask_handlers);
- return strpprintf(32, "%016lx%016lx", hash_handle, hash_handlers);
+ return strpprintf(32, "%016zx%016zx", hash_handle, hash_handlers);
}
/* }}} */
diff --git a/ext/spl/spl_array.c b/ext/spl/spl_array.c
index 60cbac5726..b35049b0bb 100644
--- a/ext/spl/spl_array.c
+++ b/ext/spl/spl_array.c
@@ -351,7 +351,7 @@ fetch_dim_string:
}
return retval;
case IS_RESOURCE:
- zend_error(E_NOTICE, "Resource ID#%pd used as offset, casting to integer (%pd)", Z_RES_P(offset)->handle, Z_RES_P(offset)->handle);
+ zend_error(E_NOTICE, "Resource ID#%d used as offset, casting to integer (%d)", Z_RES_P(offset)->handle, Z_RES_P(offset)->handle);
index = Z_RES_P(offset)->handle;
goto num_index;
case IS_DOUBLE:
@@ -369,13 +369,13 @@ num_index:
if ((retval = zend_hash_index_find(ht, index)) == NULL) {
switch (type) {
case BP_VAR_R:
- zend_error(E_NOTICE, "Undefined offset: %pd", index);
+ zend_error(E_NOTICE, "Undefined offset: " ZEND_LONG_FMT, index);
case BP_VAR_UNSET:
case BP_VAR_IS:
retval = &EG(uninitialized_zval);
break;
case BP_VAR_RW:
- zend_error(E_NOTICE, "Undefined offset: %pd", index);
+ zend_error(E_NOTICE, "Undefined offset: " ZEND_LONG_FMT, index);
case BP_VAR_W: {
zval value;
ZVAL_UNDEF(&value);
@@ -594,7 +594,7 @@ try_again:
num_index:
ht = spl_array_get_hash_table(intern);
if (zend_hash_index_del(ht, index) == FAILURE) {
- zend_error(E_NOTICE,"Undefined offset: %pd", index);
+ zend_error(E_NOTICE,"Undefined offset: " ZEND_LONG_FMT, index);
}
break;
case IS_REFERENCE:
@@ -1373,7 +1373,7 @@ SPL_METHOD(Array, seek)
return; /* ok */
}
}
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position %pd is out of range", opos);
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position " ZEND_LONG_FMT " is out of range", opos);
} /* }}} */
int static spl_array_object_count_elements_helper(spl_array_object *intern, zend_long *count) /* {{{ */
@@ -1826,7 +1826,7 @@ SPL_METHOD(Array, unserialize)
outexcept:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset " ZEND_LONG_FMT " of %zd bytes", (zend_long)((char*)p - buf), buf_len);
return;
} /* }}} */
diff --git a/ext/spl/spl_directory.c b/ext/spl/spl_directory.c
index fdae966023..1a0a1a3540 100644
--- a/ext/spl/spl_directory.c
+++ b/ext/spl/spl_directory.c
@@ -834,7 +834,7 @@ SPL_METHOD(DirectoryIterator, seek)
zval_ptr_dtor(&retval);
}
if (!valid) {
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position %ld is out of range", pos);
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Seek position " ZEND_LONG_FMT " is out of range", pos);
return;
}
zend_call_method_with_0_params(&EX(This), Z_OBJCE(EX(This)), &intern->u.dir.func_next, "next", NULL);
@@ -2322,7 +2322,7 @@ SPL_METHOD(SplTempFileObject, __construct)
intern->file_name = "php://memory";
intern->file_name_len = 12;
} else if (ZEND_NUM_ARGS()) {
- intern->file_name_len = slprintf(tmp_fname, sizeof(tmp_fname), "php://temp/maxmemory:%pd", max_memory);
+ intern->file_name_len = slprintf(tmp_fname, sizeof(tmp_fname), "php://temp/maxmemory:" ZEND_LONG_FMT, max_memory);
intern->file_name = tmp_fname;
} else {
intern->file_name = "php://temp";
@@ -2966,7 +2966,7 @@ SPL_METHOD(SplFileObject, seek)
}
if (line_pos < 0) {
- zend_throw_exception_ex(spl_ce_LogicException, 0, "Can't seek file %s to negative line %pd", intern->file_name, line_pos);
+ zend_throw_exception_ex(spl_ce_LogicException, 0, "Can't seek file %s to negative line " ZEND_LONG_FMT, intern->file_name, line_pos);
RETURN_FALSE;
}
diff --git a/ext/spl/spl_dllist.c b/ext/spl/spl_dllist.c
index 1675c7eaf3..7662493cfe 100644
--- a/ext/spl/spl_dllist.c
+++ b/ext/spl/spl_dllist.c
@@ -1223,7 +1223,7 @@ SPL_METHOD(SplDoublyLinkedList, unserialize)
error:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %zd of %zd bytes", ((char*)p - buf), buf_len);
return;
} /* }}} */
diff --git a/ext/spl/spl_iterators.c b/ext/spl/spl_iterators.c
index 6a0049733f..537ea0098b 100644
--- a/ext/spl/spl_iterators.c
+++ b/ext/spl/spl_iterators.c
@@ -1550,7 +1550,7 @@ static spl_dual_it_object* spl_dual_it_construct(INTERNAL_FUNCTION_PARAMETERS, z
return NULL;
}
if (mode < 0 || mode >= REGIT_MODE_MAX) {
- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Illegal mode %pd", mode);
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Illegal mode " ZEND_LONG_FMT, mode);
return NULL;
}
intern->u.regex.mode = mode;
@@ -2156,7 +2156,7 @@ SPL_METHOD(RegexIterator, setMode)
}
if (mode < 0 || mode >= REGIT_MODE_MAX) {
- zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Illegal mode %pd", mode);
+ zend_throw_exception_ex(spl_ce_InvalidArgumentException, 0, "Illegal mode " ZEND_LONG_FMT, mode);
return;/* NULL */
}
@@ -2494,11 +2494,11 @@ static inline void spl_limit_it_seek(spl_dual_it_object *intern, zend_long pos)
spl_dual_it_free(intern);
if (pos < intern->u.limit.offset) {
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Cannot seek to %pd which is below the offset %pd", pos, intern->u.limit.offset);
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Cannot seek to " ZEND_LONG_FMT " which is below the offset " ZEND_LONG_FMT, pos, intern->u.limit.offset);
return;
}
if (pos >= intern->u.limit.offset + intern->u.limit.count && intern->u.limit.count != -1) {
- zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Cannot seek to %pd which is behind offset %pd plus count %pd", pos, intern->u.limit.offset, intern->u.limit.count);
+ zend_throw_exception_ex(spl_ce_OutOfBoundsException, 0, "Cannot seek to " ZEND_LONG_FMT " which is behind offset " ZEND_LONG_FMT " plus count " ZEND_LONG_FMT, pos, intern->u.limit.offset, intern->u.limit.count);
return;
}
if (pos != intern->current.pos && instanceof_function(intern->inner.ce, spl_ce_SeekableIterator)) {
@@ -2925,7 +2925,7 @@ SPL_METHOD(CachingIterator, getCache)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
@@ -2995,7 +2995,7 @@ SPL_METHOD(CachingIterator, count)
SPL_FETCH_AND_CHECK_DUAL_IT(intern, getThis());
if (!(intern->u.caching.flags & CIT_FULL_CACHE)) {
- zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%v does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
+ zend_throw_exception_ex(spl_ce_BadMethodCallException, 0, "%s does not use a full cache (see CachingIterator::__construct)", ZSTR_VAL(Z_OBJCE_P(getThis())->name));
return;
}
diff --git a/ext/spl/spl_observer.c b/ext/spl/spl_observer.c
index 223e252e63..2f95ecc7b9 100644
--- a/ext/spl/spl_observer.c
+++ b/ext/spl/spl_observer.c
@@ -865,7 +865,7 @@ SPL_METHOD(SplObjectStorage, unserialize)
outexcept:
PHP_VAR_UNSERIALIZE_DESTROY(var_hash);
- zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %pd of %d bytes", (zend_long)((char*)p - buf), buf_len);
+ zend_throw_exception_ex(spl_ce_UnexpectedValueException, 0, "Error at offset %zd of %zd bytes", ((char*)p - buf), buf_len);
return;
} /* }}} */
diff --git a/ext/standard/array.c b/ext/standard/array.c
index 40c093eff3..4dba1a15f3 100644
--- a/ext/standard/array.c
+++ b/ext/standard/array.c
@@ -2119,7 +2119,7 @@ PHP_FUNCTION(array_fill_keys)
#define RANGE_CHECK_LONG_INIT_ARRAY(start, end) do { \
zend_ulong __calc_size = (start - end) / lstep; \
if (__calc_size >= HT_MAX_SIZE - 1) { \
- php_error_docref(NULL, E_WARNING, "The supplied range exceeds the maximum array size: start=%pd end=%pd", end, start); \
+ php_error_docref(NULL, E_WARNING, "The supplied range exceeds the maximum array size: start=" ZEND_LONG_FMT " end=" ZEND_LONG_FMT, end, start); \
RETURN_FALSE; \
} \
size = (uint32_t)(__calc_size + 1); \
diff --git a/ext/standard/assert.c b/ext/standard/assert.c
index 016c90e02e..f66e343f98 100644
--- a/ext/standard/assert.c
+++ b/ext/standard/assert.c
@@ -370,7 +370,7 @@ PHP_FUNCTION(assert_options)
break;
default:
- php_error_docref(NULL, E_WARNING, "Unknown value %pd", what);
+ php_error_docref(NULL, E_WARNING, "Unknown value " ZEND_LONG_FMT, what);
break;
}
diff --git a/ext/standard/dir.c b/ext/standard/dir.c
index 810dc18026..34ba7431f5 100644
--- a/ext/standard/dir.c
+++ b/ext/standard/dir.c
@@ -278,7 +278,7 @@ PHP_FUNCTION(closedir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL, E_WARNING, "%pd is not a valid Directory resource", dirp->res->handle);
+ php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle);
RETURN_FALSE;
}
@@ -394,7 +394,7 @@ PHP_FUNCTION(rewinddir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL, E_WARNING, "%pd is not a valid Directory resource", dirp->res->handle);
+ php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle);
RETURN_FALSE;
}
@@ -413,7 +413,7 @@ PHP_NAMED_FUNCTION(php_if_readdir)
FETCH_DIRP();
if (!(dirp->flags & PHP_STREAM_FLAG_IS_DIR)) {
- php_error_docref(NULL, E_WARNING, "%pd is not a valid Directory resource", dirp->res->handle);
+ php_error_docref(NULL, E_WARNING, "%d is not a valid Directory resource", dirp->res->handle);
RETURN_FALSE;
}
diff --git a/ext/standard/file.c b/ext/standard/file.c
index eef1287b0f..dcd13fa9a3 100644
--- a/ext/standard/file.c
+++ b/ext/standard/file.c
@@ -555,7 +555,7 @@ PHP_FUNCTION(file_get_contents)
}
if (maxlen > INT_MAX) {
- php_error_docref(NULL, E_WARNING, "maxlen truncated from %pd to %d bytes", maxlen, INT_MAX);
+ php_error_docref(NULL, E_WARNING, "maxlen truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
maxlen = INT_MAX;
}
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0)) != NULL) {
@@ -897,7 +897,7 @@ PHPAPI PHP_FUNCTION(fclose)
PHP_STREAM_TO_ZVAL(stream, res);
if ((stream->flags & PHP_STREAM_FLAG_NO_FCLOSE) != 0) {
- php_error_docref(NULL, E_WARNING, "%pd is not a valid stream resource", stream->res->handle);
+ php_error_docref(NULL, E_WARNING, "%d is not a valid stream resource", stream->res->handle);
RETURN_FALSE;
}
diff --git a/ext/standard/formatted_print.c b/ext/standard/formatted_print.c
index 502de05cb2..39034bc685 100644
--- a/ext/standard/formatted_print.c
+++ b/ext/standard/formatted_print.c
@@ -87,7 +87,7 @@ php_sprintf_appendstring(zend_string **buffer, size_t *pos, char *add,
m_width = MAX(min_width, copy_len);
if(m_width > INT_MAX - *pos - 1) {
- zend_error_noreturn(E_ERROR, "Field width %d is too long", m_width);
+ zend_error_noreturn(E_ERROR, "Field width %zd is too long", m_width);
}
req_size = *pos + m_width + 1;
diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c
index e59c04fc34..c85a506d97 100644
--- a/ext/standard/ftp_fopen_wrapper.c
+++ b/ext/standard/ftp_fopen_wrapper.c
@@ -531,10 +531,10 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa
(tmpzval = php_stream_context_get_option(context, "ftp", "resume_pos")) != NULL &&
Z_TYPE_P(tmpzval) == IS_LONG &&
Z_LVAL_P(tmpzval) > 0) {
- php_stream_printf(stream, "REST %pd\r\n", Z_LVAL_P(tmpzval));
+ php_stream_printf(stream, "REST " ZEND_LONG_FMT "\r\n", Z_LVAL_P(tmpzval));
result = GET_FTP_RESULT(stream);
if (result < 300 || result > 399) {
- php_stream_wrapper_log_error(wrapper, options, "Unable to resume from offset %pd", Z_LVAL_P(tmpzval));
+ php_stream_wrapper_log_error(wrapper, options, "Unable to resume from offset " ZEND_LONG_FMT, Z_LVAL_P(tmpzval));
goto errexit;
}
}
diff --git a/ext/standard/http.c b/ext/standard/http.c
index 528aff3c95..4d173e57a1 100644
--- a/ext/standard/http.c
+++ b/ext/standard/http.c
@@ -110,7 +110,7 @@ PHPAPI int php_url_encode_hash_ex(HashTable *ht, smart_str *formstr,
char *ekey;
size_t ekey_len;
/* Is an integer key */
- ekey_len = spprintf(&ekey, 0, "%pd", idx);
+ ekey_len = spprintf(&ekey, 0, ZEND_LONG_FMT, idx);
newprefix_len = key_prefix_len + num_prefix_len + ekey_len + key_suffix_len + 3 /* %5B */;
newprefix = emalloc(newprefix_len + 1);
p = newprefix;
diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c
index 02b580fa28..fd996d1763 100644
--- a/ext/standard/http_fopen_wrapper.c
+++ b/ext/standard/http_fopen_wrapper.c
@@ -629,7 +629,7 @@ finish:
(tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL &&
Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0
) {
- scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval));
+ scratch_len = slprintf(scratch, scratch_len, "Content-Length: %zd\r\n", Z_STRLEN_P(tmpzval));
php_stream_write(stream, scratch, scratch_len);
have_header |= HTTP_HEADER_CONTENT_LENGTH;
}
@@ -644,7 +644,7 @@ finish:
(tmpzval = php_stream_context_get_option(context, "http", "content")) != NULL &&
Z_TYPE_P(tmpzval) == IS_STRING && Z_STRLEN_P(tmpzval) > 0) {
if (!(have_header & HTTP_HEADER_CONTENT_LENGTH)) {
- scratch_len = slprintf(scratch, scratch_len, "Content-Length: %d\r\n", Z_STRLEN_P(tmpzval));
+ scratch_len = slprintf(scratch, scratch_len, "Content-Length: %zd\r\n", Z_STRLEN_P(tmpzval));
php_stream_write(stream, scratch, scratch_len);
}
if (!(have_header & HTTP_HEADER_TYPE)) {
diff --git a/ext/standard/math.c b/ext/standard/math.c
index 688ae9f6d1..0a408d0adc 100644
--- a/ext/standard/math.c
+++ b/ext/standard/math.c
@@ -1249,11 +1249,11 @@ PHP_FUNCTION(base_convert)
convert_to_string_ex(number);
if (frombase < 2 || frombase > 36) {
- php_error_docref(NULL, E_WARNING, "Invalid `from base' (%pd)", frombase);
+ php_error_docref(NULL, E_WARNING, "Invalid `from base' (" ZEND_LONG_FMT ")", frombase);
RETURN_FALSE;
}
if (tobase < 2 || tobase > 36) {
- php_error_docref(NULL, E_WARNING, "Invalid `to base' (%pd)", tobase);
+ php_error_docref(NULL, E_WARNING, "Invalid `to base' (" ZEND_LONG_FMT ")", tobase);
RETURN_FALSE;
}
diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c
index f235fee967..e443ec64a6 100644
--- a/ext/standard/proc_open.c
+++ b/ext/standard/proc_open.c
@@ -544,7 +544,7 @@ PHP_FUNCTION(proc_open)
#else
descriptors[ndesc].childend = dup(fd);
if (descriptors[ndesc].childend < 0) {
- php_error_docref(NULL, E_WARNING, "unable to dup File-Handle for descriptor %pd - %s", nindex, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "unable to dup File-Handle for descriptor " ZEND_ULONG_FMT " - %s", nindex, strerror(errno));
goto exit_fail;
}
#endif
diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c
index 0e5d0ce79e..a8bedab098 100644
--- a/ext/standard/streamsfuncs.c
+++ b/ext/standard/streamsfuncs.c
@@ -438,13 +438,13 @@ PHP_FUNCTION(stream_get_contents)
if (seek_res != 0) {
php_error_docref(NULL, E_WARNING,
- "Failed to seek to position %pd in the stream", desiredpos);
+ "Failed to seek to position " ZEND_LONG_FMT " in the stream", desiredpos);
RETURN_FALSE;
}
}
if (maxlen > INT_MAX) {
- php_error_docref(NULL, E_WARNING, "maxlen truncated from %pd to %d bytes", maxlen, INT_MAX);
+ php_error_docref(NULL, E_WARNING, "maxlen truncated from " ZEND_LONG_FMT " to %d bytes", maxlen, INT_MAX);
maxlen = INT_MAX;
}
if ((contents = php_stream_copy_to_mem(stream, maxlen, 0))) {
diff --git a/ext/standard/var.c b/ext/standard/var.c
index 16b9fffba1..efd5119fed 100644
--- a/ext/standard/var.c
+++ b/ext/standard/var.c
@@ -171,7 +171,7 @@ again:
break;
case IS_RESOURCE: {
const char *type_name = zend_rsrc_list_get_rsrc_type(Z_RES_P(struc));
- php_printf("%sresource(%pd) of type (%s)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown");
+ php_printf("%sresource(%d) of type (%s)\n", COMMON, Z_RES_P(struc)->handle, type_name ? type_name : "Unknown");
break;
}
case IS_REFERENCE:
diff --git a/ext/standard/var_unserializer.c b/ext/standard/var_unserializer.c
index 3fc074dd6a..e2b95174d7 100644
--- a/ext/standard/var_unserializer.c
+++ b/ext/standard/var_unserializer.c
@@ -411,7 +411,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
(*p) += 2;
if (datalen < 0 || (max - (*p)) <= datalen) {
- zend_error(E_WARNING, "Insufficient data for unserializing - %pd required, %pd present", datalen, (zend_long)(max - (*p)));
+ zend_error(E_WARNING, "Insufficient data for unserializing - " ZEND_LONG_FMT " required, " ZEND_LONG_FMT " present", datalen, (zend_long)(max - (*p)));
return 0;
}
diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re
index 81cc26db9d..52e2cf3646 100644
--- a/ext/standard/var_unserializer.re
+++ b/ext/standard/var_unserializer.re
@@ -415,7 +415,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce)
(*p) += 2;
if (datalen < 0 || (max - (*p)) <= datalen) {
- zend_error(E_WARNING, "Insufficient data for unserializing - %pd required, %pd present", datalen, (zend_long)(max - (*p)));
+ zend_error(E_WARNING, "Insufficient data for unserializing - " ZEND_LONG_FMT " required, " ZEND_LONG_FMT " present", datalen, (zend_long)(max - (*p)));
return 0;
}
diff --git a/ext/sysvmsg/sysvmsg.c b/ext/sysvmsg/sysvmsg.c
index b291daed03..c4ebc48800 100644
--- a/ext/sysvmsg/sysvmsg.c
+++ b/ext/sysvmsg/sysvmsg.c
@@ -268,7 +268,7 @@ PHP_FUNCTION(msg_get_queue)
/* doesn't already exist; create it */
mq->id = msgget(key, IPC_CREAT | IPC_EXCL | perms);
if (mq->id < 0) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%lx: %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
efree(mq);
RETURN_FALSE;
}
@@ -435,7 +435,7 @@ PHP_FUNCTION(msg_send)
break;
case IS_LONG:
- message_len = spprintf(&p, 0, "%pd", Z_LVAL_P(message));
+ message_len = spprintf(&p, 0, ZEND_LONG_FMT, Z_LVAL_P(message));
break;
case IS_FALSE:
message_len = spprintf(&p, 0, "0");
diff --git a/ext/sysvsem/sysvsem.c b/ext/sysvsem/sysvsem.c
index e28e6b4c1b..923f7c3853 100644
--- a/ext/sysvsem/sysvsem.c
+++ b/ext/sysvsem/sysvsem.c
@@ -206,7 +206,7 @@ PHP_FUNCTION(sem_get)
semid = semget(key, 3, perm|IPC_CREAT);
if (semid == -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%lx: %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
RETURN_FALSE;
}
@@ -238,7 +238,7 @@ PHP_FUNCTION(sem_get)
sop[2].sem_flg = SEM_UNDO;
while (semop(semid, sop, 3) == -1) {
if (errno != EINTR) {
- php_error_docref(NULL, E_WARNING, "failed acquiring SYSVSEM_SETVAL for key 0x%lx: %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed acquiring SYSVSEM_SETVAL for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
break;
}
}
@@ -246,7 +246,7 @@ PHP_FUNCTION(sem_get)
/* Get the usage count. */
count = semctl(semid, SYSVSEM_USAGE, GETVAL, NULL);
if (count == -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%lx: %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
}
/* If we are the only user, then take this opportunity to set the max. */
@@ -257,7 +257,7 @@ PHP_FUNCTION(sem_get)
union semun semarg;
semarg.val = max_acquire;
if (semctl(semid, SYSVSEM_SEM, SETVAL, semarg) == -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%lx: %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
}
#elif defined(SETVAL_WANTS_PTR)
/* This is correct for Solaris 2.6 which does not have union semun. */
@@ -279,7 +279,7 @@ PHP_FUNCTION(sem_get)
sop[0].sem_flg = SEM_UNDO;
while (semop(semid, sop, 1) == -1) {
if (errno != EINTR) {
- php_error_docref(NULL, E_WARNING, "failed releasing SYSVSEM_SETVAL for key 0x%lx: %s", key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed releasing SYSVSEM_SETVAL for key 0x" ZEND_XLONG_FMT ": %s", key, strerror(errno));
break;
}
}
@@ -319,7 +319,7 @@ static void php_sysvsem_semop(INTERNAL_FUNCTION_PARAMETERS, int acquire)
}
if (!acquire && sem_ptr->count == 0) {
- php_error_docref(NULL, E_WARNING, "SysV semaphore %ld (key 0x%x) is not currently acquired", Z_LVAL_P(arg_id), sem_ptr->key);
+ php_error_docref(NULL, E_WARNING, "SysV semaphore " ZEND_LONG_FMT " (key 0x%x) is not currently acquired", Z_LVAL_P(arg_id), sem_ptr->key);
RETURN_FALSE;
}
@@ -388,7 +388,7 @@ PHP_FUNCTION(sem_remove)
#else
if (semctl(sem_ptr->semid, 0, IPC_STAT, NULL) < 0) {
#endif
- php_error_docref(NULL, E_WARNING, "SysV semaphore %ld does not (any longer) exist", Z_LVAL_P(arg_id));
+ php_error_docref(NULL, E_WARNING, "SysV semaphore " ZEND_LONG_FMT " does not (any longer) exist", Z_LVAL_P(arg_id));
RETURN_FALSE;
}
@@ -397,7 +397,7 @@ PHP_FUNCTION(sem_remove)
#else
if (semctl(sem_ptr->semid, 0, IPC_RMID, NULL) < 0) {
#endif
- php_error_docref(NULL, E_WARNING, "failed for SysV sempphore %ld: %s", Z_LVAL_P(arg_id), strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed for SysV sempphore " ZEND_LONG_FMT ": %s", Z_LVAL_P(arg_id), strerror(errno));
RETURN_FALSE;
}
diff --git a/ext/sysvshm/sysvshm.c b/ext/sysvshm/sysvshm.c
index 2ecb19dd0f..55381dbbed 100644
--- a/ext/sysvshm/sysvshm.c
+++ b/ext/sysvshm/sysvshm.c
@@ -170,19 +170,19 @@ PHP_FUNCTION(shm_attach)
/* get the id from a specified key or create new shared memory */
if ((shm_id = shmget(shm_key, 0, 0)) < 0) {
if (shm_size < sizeof(sysvshm_chunk_head)) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%px: memorysize too small", shm_key);
+ php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": memorysize too small", shm_key);
efree(shm_list_ptr);
RETURN_FALSE;
}
if ((shm_id = shmget(shm_key, shm_size, shm_flag | IPC_CREAT | IPC_EXCL)) < 0) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%px: %s", shm_key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_XLONG_FMT ": %s", shm_key, strerror(errno));
efree(shm_list_ptr);
RETURN_FALSE;
}
}
if ((shm_ptr = shmat(shm_id, NULL, 0)) == (void *) -1) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%px: %s", shm_key, strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed for key 0x" ZEND_LONG_FMT ": %s", shm_key, strerror(errno));
efree(shm_list_ptr);
RETURN_FALSE;
}
@@ -233,7 +233,7 @@ PHP_FUNCTION(shm_remove)
SHM_FETCH_RESOURCE(shm_list_ptr, shm_id);
if (shmctl(shm_list_ptr->id, IPC_RMID, NULL) < 0) {
- php_error_docref(NULL, E_WARNING, "failed for key 0x%x, id %ld: %s", shm_list_ptr->key, Z_LVAL_P(shm_id), strerror(errno));
+ php_error_docref(NULL, E_WARNING, "failed for key 0x%x, id " ZEND_LONG_FMT ": %s", shm_list_ptr->key, Z_LVAL_P(shm_id), strerror(errno));
RETURN_FALSE;
}
@@ -303,7 +303,7 @@ PHP_FUNCTION(shm_get_var)
shm_varpos = php_check_shm_data((shm_list_ptr->ptr), shm_key);
if (shm_varpos < 0) {
- php_error_docref(NULL, E_WARNING, "variable key %pd doesn't exist", shm_key);
+ php_error_docref(NULL, E_WARNING, "variable key " ZEND_LONG_FMT " doesn't exist", shm_key);
RETURN_FALSE;
}
shm_var = (sysvshm_chunk*) ((char *)shm_list_ptr->ptr + shm_varpos);
@@ -350,7 +350,7 @@ PHP_FUNCTION(shm_remove_var)
shm_varpos = php_check_shm_data((shm_list_ptr->ptr), shm_key);
if (shm_varpos < 0) {
- php_error_docref(NULL, E_WARNING, "variable key %pd doesn't exist", shm_key);
+ php_error_docref(NULL, E_WARNING, "variable key " ZEND_LONG_FMT " doesn't exist", shm_key);
RETURN_FALSE;
}
php_remove_shm_data((shm_list_ptr->ptr), shm_varpos);
diff --git a/ext/xmlrpc/xmlrpc-epi-php.c b/ext/xmlrpc/xmlrpc-epi-php.c
index b5dcee8f0d..f42cdf0c16 100644
--- a/ext/xmlrpc/xmlrpc-epi-php.c
+++ b/ext/xmlrpc/xmlrpc-epi-php.c
@@ -576,7 +576,7 @@ static XMLRPC_VALUE PHP_to_XMLRPC_worker (const char* key, zval* in_val, int dep
char *num_str = NULL;
if (vtype != xmlrpc_vector_array) {
- spprintf(&num_str, 0, "%ld", num_index);
+ spprintf(&num_str, 0, ZEND_LONG_FMT, num_index);
}
XMLRPC_AddValueToVector(xReturn, PHP_to_XMLRPC_worker(num_str, pIter, depth++));
diff --git a/ext/zip/php_zip.c b/ext/zip/php_zip.c
index df08882242..73f31bbcd8 100644
--- a/ext/zip/php_zip.c
+++ b/ext/zip/php_zip.c
@@ -1694,7 +1694,7 @@ static void php_zip_add_from_pattern(INTERNAL_FUNCTION_PARAMETERS, int type) /*
if (add_path) {
if ((add_path_len + file_stripped_len) > MAXPATHLEN) {
- php_error_docref(NULL, E_WARNING, "Entry name too long (max: %d, %pd given)",
+ php_error_docref(NULL, E_WARNING, "Entry name too long (max: %d, %zd given)",
MAXPATHLEN - 1, (add_path_len + file_stripped_len));
zval_ptr_dtor(return_value);
RETURN_FALSE;
diff --git a/ext/zlib/zlib.c b/ext/zlib/zlib.c
index d9d6be1638..af54d77181 100644
--- a/ext/zlib/zlib.c
+++ b/ext/zlib/zlib.c
@@ -673,7 +673,7 @@ static PHP_FUNCTION(name) \
} \
} \
if (level < -1 || level > 9) { \
- php_error_docref(NULL, E_WARNING, "compression level (%pd) must be within -1..9", level); \
+ php_error_docref(NULL, E_WARNING, "compression level (" ZEND_LONG_FMT ") must be within -1..9", level); \
RETURN_FALSE; \
} \
switch (encoding) { \
@@ -702,7 +702,7 @@ static PHP_FUNCTION(name) \
return; \
} \
if (max_len < 0) { \
- php_error_docref(NULL, E_WARNING, "length (%pd) must be greater or equal zero", max_len); \
+ php_error_docref(NULL, E_WARNING, "length (" ZEND_LONG_FMT ") must be greater or equal zero", max_len); \
RETURN_FALSE; \
} \
if (SUCCESS != php_zlib_decode(in_buf, in_len, &out_buf, &out_len, encoding, max_len)) { \
@@ -863,7 +863,7 @@ PHP_FUNCTION(inflate_init)
window = zval_get_long(option_buffer);
}
if (window < 8 || window > 15) {
- php_error_docref(NULL, E_WARNING, "zlib window size (lograithm) (%pd) must be within 8..15", window);
+ php_error_docref(NULL, E_WARNING, "zlib window size (lograithm) (" ZEND_LONG_FMT ") must be within 8..15", window);
RETURN_FALSE;
}
@@ -1033,7 +1033,7 @@ PHP_FUNCTION(deflate_init)
level = zval_get_long(option_buffer);
}
if (level < -1 || level > 9) {
- php_error_docref(NULL, E_WARNING, "compression level (%pd) must be within -1..9", level);
+ php_error_docref(NULL, E_WARNING, "compression level (" ZEND_LONG_FMT ") must be within -1..9", level);
RETURN_FALSE;
}
@@ -1041,7 +1041,7 @@ PHP_FUNCTION(deflate_init)
memory = zval_get_long(option_buffer);
}
if (memory < 1 || memory > 9) {
- php_error_docref(NULL, E_WARNING, "compression memory level (%pd) must be within 1..9", memory);
+ php_error_docref(NULL, E_WARNING, "compression memory level (" ZEND_LONG_FMT ") must be within 1..9", memory);
RETURN_FALSE;
}
@@ -1049,7 +1049,7 @@ PHP_FUNCTION(deflate_init)
window = zval_get_long(option_buffer);
}
if (window < 8 || window > 15) {
- php_error_docref(NULL, E_WARNING, "zlib window size (logarithm) (%pd) must be within 8..15", window);
+ php_error_docref(NULL, E_WARNING, "zlib window size (logarithm) (" ZEND_LONG_FMT ") must be within 8..15", window);
RETURN_FALSE;
}
diff --git a/ext/zlib/zlib_filter.c b/ext/zlib/zlib_filter.c
index 8313b5bb1d..e1c8c22e6d 100644
--- a/ext/zlib/zlib_filter.c
+++ b/ext/zlib/zlib_filter.c
@@ -333,7 +333,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
/* log-2 base of history window (9 - 15) */
zend_long tmp = zval_get_long(tmpzval);
if (tmp < -MAX_WBITS || tmp > MAX_WBITS + 32) {
- php_error_docref(NULL, E_WARNING, "Invalid parameter give for window size. (%pd)", tmp);
+ php_error_docref(NULL, E_WARNING, "Invalid parameter give for window size. (" ZEND_LONG_FMT ")", tmp);
} else {
windowBits = tmp;
}
@@ -365,7 +365,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
/* Memory Level (1 - 9) */
tmp = zval_get_long(tmpzval);
if (tmp < 1 || tmp > MAX_MEM_LEVEL) {
- php_error_docref(NULL, E_WARNING, "Invalid parameter give for memory level. (%pd)", tmp);
+ php_error_docref(NULL, E_WARNING, "Invalid parameter give for memory level. (" ZEND_LONG_FMT ")", tmp);
} else {
memLevel = tmp;
}
@@ -375,7 +375,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
/* log-2 base of history window (9 - 15) */
tmp = zval_get_long(tmpzval);
if (tmp < -MAX_WBITS || tmp > MAX_WBITS + 16) {
- php_error_docref(NULL, E_WARNING, "Invalid parameter give for window size. (%pd)", tmp);
+ php_error_docref(NULL, E_WARNING, "Invalid parameter give for window size. (" ZEND_LONG_FMT ")", tmp);
} else {
windowBits = tmp;
}
@@ -395,7 +395,7 @@ static php_stream_filter *php_zlib_filter_create(const char *filtername, zval *f
factory_setlevel:
/* Set compression level within reason (-1 == default, 0 == none, 1-9 == least to most compression */
if (tmp < -1 || tmp > 9) {
- php_error_docref(NULL, E_WARNING, "Invalid compression level specified. (%pd)", tmp);
+ php_error_docref(NULL, E_WARNING, "Invalid compression level specified. (" ZEND_LONG_FMT ")", tmp);
} else {
level = tmp;
}
diff --git a/main/SAPI.c b/main/SAPI.c
index 496bbfbd12..31b8bea9a7 100644
--- a/main/SAPI.c
+++ b/main/SAPI.c
@@ -262,7 +262,7 @@ SAPI_API size_t sapi_read_post_block(char *buffer, size_t buflen)
SAPI_API SAPI_POST_READER_FUNC(sapi_read_standard_form_data)
{
if ((SG(post_max_size) > 0) && (SG(request_info).content_length > SG(post_max_size))) {
- php_error_docref(NULL, E_WARNING, "POST Content-Length of %pd bytes exceeds the limit of %pd bytes",
+ php_error_docref(NULL, E_WARNING, "POST Content-Length of " ZEND_LONG_FMT " bytes exceeds the limit of " ZEND_LONG_FMT " bytes",
SG(request_info).content_length, SG(post_max_size));
return;
}
diff --git a/main/SAPI.h b/main/SAPI.h
index 30290b6188..d9163729a5 100644
--- a/main/SAPI.h
+++ b/main/SAPI.h
@@ -232,7 +232,7 @@ struct _sapi_module_struct {
zend_stat_t *(*get_stat)(void);
char *(*getenv)(char *name, size_t name_len);
- void (*sapi_error)(int type, const char *error_msg, ...);
+ void (*sapi_error)(int type, const char *error_msg, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
int (*header_handler)(sapi_header_struct *sapi_header, sapi_header_op_enum op, sapi_headers_struct *sapi_headers);
int (*send_headers)(sapi_headers_struct *sapi_headers);
diff --git a/main/fastcgi.h b/main/fastcgi.h
index c45a4e4835..4e96d9195c 100644
--- a/main/fastcgi.h
+++ b/main/fastcgi.h
@@ -104,7 +104,7 @@ const char *fcgi_get_last_client_ip();
void fcgi_set_in_shutdown(int new_value);
#ifndef HAVE_ATTRIBUTE_WEAK
-typedef void (*fcgi_logger)(int type, const char *fmt, ...);
+typedef void (*fcgi_logger)(int type, const char *fmt, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
void fcgi_set_logger(fcgi_logger lg);
#endif
diff --git a/main/main.c b/main/main.c
index dd48242c91..83f5c1a6b9 100644
--- a/main/main.c
+++ b/main/main.c
@@ -1124,7 +1124,7 @@ static ZEND_COLD void php_error_cb(int type, const char *error_filename, const u
if (PG(display_errors) && ((module_initialized && !PG(during_request_startup)) || (PG(display_startup_errors)))) {
if (PG(xmlrpc_errors)) {
- php_printf("<?xml version=\"1.0\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>%pd</int></value></member><member><name>faultString</name><value><string>%s:%s in %s on line %d</string></value></member></struct></value></fault></methodResponse>", PG(xmlrpc_error_number), error_type_str, buffer, error_filename, error_lineno);
+ php_printf("<?xml version=\"1.0\"?><methodResponse><fault><value><struct><member><name>faultCode</name><value><int>" ZEND_LONG_FMT "</int></value></member><member><name>faultString</name><value><string>%s:%s in %s on line %d</string></value></member></struct></value></fault></methodResponse>", PG(xmlrpc_error_number), error_type_str, buffer, error_filename, error_lineno);
} else {
char *prepend_string = INI_STR("error_prepend_string");
char *append_string = INI_STR("error_append_string");
@@ -1468,7 +1468,7 @@ static ZEND_COLD void php_message_handler_for_zend(zend_long message, const void
if (message==ZMSG_MEMORY_LEAK_DETECTED) {
zend_leak_info *t = (zend_leak_info *) data;
- snprintf(memory_leak_buf, 512, "%s(%d) : Freeing 0x%.8lX (%zu bytes), script=%s\n", t->filename, t->lineno, (zend_uintptr_t)t->addr, t->size, SAFE_FILENAME(SG(request_info).path_translated));
+ snprintf(memory_leak_buf, 512, "%s(%d) : Freeing " ZEND_ADDR_FMT " (%zu bytes), script=%s\n", t->filename, t->lineno, (size_t)t->addr, t->size, SAFE_FILENAME(SG(request_info).path_translated));
if (t->orig_filename) {
char relay_buf[512];
diff --git a/main/rfc1867.c b/main/rfc1867.c
index 14e72d91f5..d8d141fdd6 100644
--- a/main/rfc1867.c
+++ b/main/rfc1867.c
@@ -1048,7 +1048,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
cancel_upload = UPLOAD_ERROR_A;
} else if (max_file_size && ((zend_long)(total_bytes+blen) > max_file_size)) {
#if DEBUG_FILE_UPLOAD
- sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of " ZEND_LONG_FMT " bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename);
+ sapi_module.sapi_error(E_NOTICE, "MAX_FILE_SIZE of %" PRId64 " bytes exceeded - file [%s=%s] not saved", max_file_size, param, filename);
#endif
cancel_upload = UPLOAD_ERROR_B;
} else if (blen > 0) {
@@ -1066,7 +1066,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
cancel_upload = UPLOAD_ERROR_F;
} else if (wlen < blen) {
#if DEBUG_FILE_UPLOAD
- sapi_module.sapi_error(E_NOTICE, "Only %d bytes were written, expected to write %d", wlen, blen);
+ sapi_module.sapi_error(E_NOTICE, "Only %zd bytes were written, expected to write %zd", wlen, blen);
#endif
cancel_upload = UPLOAD_ERROR_F;
} else {
@@ -1257,7 +1257,7 @@ SAPI_API SAPI_POST_HANDLER_FUNC(rfc1867_post_handler) /* {{{ */
}
#else
{
- int __len = snprintf(file_size_buf, 65, "%lld", total_bytes);
+ int __len = snprintf(file_size_buf, 65, "%" PRId64, total_bytes);
file_size_buf[__len] = '\0';
}
#endif
diff --git a/main/snprintf.h b/main/snprintf.h
index 918cb60152..7bb92ecb19 100644
--- a/main/snprintf.h
+++ b/main/snprintf.h
@@ -78,12 +78,12 @@ typedef enum {
BEGIN_EXTERN_C()
-PHPAPI int ap_php_slprintf(char *buf, size_t len, const char *format,...);
+PHPAPI int ap_php_slprintf(char *buf, size_t len, const char *format,...) ZEND_ATTRIBUTE_FORMAT(printf, 3, 4);
PHPAPI int ap_php_vslprintf(char *buf, size_t len, const char *format, va_list ap);
-PHPAPI int ap_php_snprintf(char *, size_t, const char *, ...);
+PHPAPI int ap_php_snprintf(char *, size_t, const char *, ...) ZEND_ATTRIBUTE_FORMAT(printf, 3, 4);
PHPAPI int ap_php_vsnprintf(char *, size_t, const char *, va_list ap);
PHPAPI int ap_php_vasprintf(char **buf, const char *format, va_list ap);
-PHPAPI int ap_php_asprintf(char **buf, const char *format, ...);
+PHPAPI int ap_php_asprintf(char **buf, const char *format, ...) ZEND_ATTRIBUTE_FORMAT(printf, 2, 3);
PHPAPI int php_sprintf (char* s, const char* format, ...) PHP_ATTRIBUTE_FORMAT(printf, 2, 3);
PHPAPI char * php_gcvt(double value, int ndigit, char dec_point, char exponent, char *buf);
PHPAPI char * php_conv_fp(char format, double num,
diff --git a/main/streams/xp_socket.c b/main/streams/xp_socket.c
index 8dc8ef8980..fa08a11752 100644
--- a/main/streams/xp_socket.c
+++ b/main/streams/xp_socket.c
@@ -102,7 +102,7 @@ retry:
} while (err == EINTR);
}
estr = php_socket_strerror(err, NULL, 0);
- php_error_docref(NULL, E_NOTICE, "send of " ZEND_LONG_FMT " bytes failed with errno=%ld %s",
+ php_error_docref(NULL, E_NOTICE, "send of " ZEND_LONG_FMT " bytes failed with errno=%d %s",
(zend_long)count, err, estr);
efree(estr);
}
diff --git a/sapi/cli/php_cli_server.c b/sapi/cli/php_cli_server.c
index 650f488752..453fe82998 100644
--- a/sapi/cli/php_cli_server.c
+++ b/sapi/cli/php_cli_server.c
@@ -1857,7 +1857,7 @@ static int php_cli_server_send_error_page(php_cli_server *server, php_cli_server
if (!chunk) {
goto fail;
}
- snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string, ZSTR_VAL(escaped_request_uri));
+ snprintf(chunk->data.heap.p, chunk->data.heap.len, prologue_template, status, status_string);
chunk->data.heap.len = strlen(chunk->data.heap.p);
php_cli_server_buffer_append(&client->content_sender.buffer, chunk);
}
diff --git a/sapi/fpm/fpm/fpm_log.c b/sapi/fpm/fpm/fpm_log.c
index 5aad9a08c9..e04c236991 100644
--- a/sapi/fpm/fpm/fpm_log.c
+++ b/sapi/fpm/fpm/fpm_log.c
@@ -267,13 +267,13 @@ int fpm_log_write(char *log_format) /* {{{ */
/* kilobytes */
} else if (!strcasecmp(format, "kilobytes") || !strcasecmp(format, "kilo")) {
if (!test) {
- len2 = snprintf(b, FPM_LOG_BUFFER - len, "%lu", proc.memory / 1024);
+ len2 = snprintf(b, FPM_LOG_BUFFER - len, "%zu", proc.memory / 1024);
}
/* megabytes */
} else if (!strcasecmp(format, "megabytes") || !strcasecmp(format, "mega")) {
if (!test) {
- len2 = snprintf(b, FPM_LOG_BUFFER - len, "%lu", proc.memory / 1024 / 1024);
+ len2 = snprintf(b, FPM_LOG_BUFFER - len, "%zu", proc.memory / 1024 / 1024);
}
} else {