Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions UPGRADING.INTERNALS
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,19 @@ PHP 8.6 INTERNALS UPGRADE NOTES
1. Internal API changes
========================

- Breaking changes:
. String formatting functions now support the custom conversion specifiers
'pS' (zend_string*) and 'pp' (same as 'p'). Following the 'p' specifier with
an alpha-numeric character other than 'S' or 'p' is now an error.

Examples:

zend_string *str;
zend_spprintf("%pS", str); // valid, same as "%S"
zend_spprintf("%pp", str); // valid, same as "%p"
zend_spprintf("%pA", str); // invalid
zend_spprintf("%ppA", str); // valid, same as zend_spprintf("%p%c", str, 'A')

- Removed:
. The misnamed ZVAL_IS_NULL() has been removed. Use Z_ISNULL() instead.
. The zval_is_true() alias of zend_is_true() has been removed. Call
Expand Down
4 changes: 2 additions & 2 deletions Zend/zend_compile.c
Original file line number Diff line number Diff line change
Expand Up @@ -8583,8 +8583,8 @@ static void zend_compile_closure_binding(znode *closure, zend_op_array *op_array

value = zend_hash_add(op_array->static_variables, var_name, &EG(uninitialized_zval));
if (!value) {
zend_error_noreturn_unchecked(E_COMPILE_ERROR,
"Cannot use variable $%S twice", var_name);
zend_error_noreturn(E_COMPILE_ERROR,
"Cannot use variable $%pS twice", var_name);
}

CG(zend_lineno) = zend_ast_get_lineno(var_name_ast);
Expand Down
2 changes: 1 addition & 1 deletion ext/sqlite3/sqlite3.c
Original file line number Diff line number Diff line change
Expand Up @@ -1660,7 +1660,7 @@ static int php_sqlite3_bind_params(php_sqlite3_stmt *stmt_obj) /* {{{ */
break;

default:
php_sqlite3_error(stmt_obj->db_obj, 0, "Unknown parameter type: %pd for parameter %pd", param->type, param->param_number);
php_sqlite3_error(stmt_obj->db_obj, 0, "Unknown parameter type: " ZEND_LONG_FMT " for parameter " ZEND_LONG_FMT, param->type, param->param_number);
return FAILURE;
}
} ZEND_HASH_FOREACH_END();
Expand Down
19 changes: 19 additions & 0 deletions main/spprintf.c
Original file line number Diff line number Diff line change
Expand Up @@ -362,6 +362,7 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
break;
}
case 'S': {
format_zend_string:;
zend_string *str = va_arg(ap, zend_string*);
s_len = ZSTR_LEN(str);
s = ZSTR_VAL(str);
Expand Down Expand Up @@ -665,6 +666,24 @@ static void xbuf_format_converter(void *xbuf, bool is_char, const char *fmt, va_
* we print "%p" to indicate that we don't handle "%p".
*/
case 'p':
/* %p[alnum]+ extensions */
switch (*(fmt+1)) {
case 'S':
/* zend_string* */
fmt++;
goto format_zend_string;
case 'p':
/* pointer */
fmt++;
break;
default:
if (isalnum(*(fmt+1))) {
zend_error_noreturn(E_CORE_ERROR,
"Invalid printf specifier \"p%c\"", *(fmt+1));
}
break;
}
/* Normal %p */
if (sizeof(char *) <= sizeof(uint64_t)) {
ui_num = (uint64_t)((size_t) va_arg(ap, char *));
s = ap_php_conv_p2(ui_num, 4, 'x',
Expand Down
Loading