diff --git a/Zend/tests/anon/012.phpt b/Zend/tests/anon/012.phpt index d82f237c1c8c..90d7479c329a 100644 --- a/Zend/tests/anon/012.phpt +++ b/Zend/tests/anon/012.phpt @@ -4,8 +4,8 @@ Ensure correct unmangling of private property names for anonymous class instance ---EXPECT-- -object(class@anonymous)#1 (1) { +--EXPECTF-- +object(class@anonymous%0%s:2$%x)#1 (1) { ["foo":"class@anonymous":private]=> NULL } diff --git a/Zend/tests/anon/013.phpt b/Zend/tests/anon/013.phpt index b66be660d70c..b0c38a8391d6 100644 --- a/Zend/tests/anon/013.phpt +++ b/Zend/tests/anon/013.phpt @@ -10,6 +10,6 @@ $foo = function() { $closure = Closure::bind($foo, $class, $class); var_dump($closure()); ?> ---EXPECT-- -object(class@anonymous)#1 (0) { +--EXPECTF-- +object(class@anonymous%0%s:2$%x)#1 (0) { } diff --git a/Zend/tests/bug72598.phpt b/Zend/tests/bug72598.phpt index 741abc35e227..0173439a42fa 100644 --- a/Zend/tests/bug72598.phpt +++ b/Zend/tests/bug72598.phpt @@ -18,9 +18,9 @@ new class { ?> --EXPECTF-- Warning: ref(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d -object(class@anonymous)#1 (0) { +object(class@anonymous%0%s:6$%x)#1 (0) { } Warning: ref(): Argument #1 ($ref) must be passed by reference, value given in %s on line %d -object(class@anonymous)#1 (0) { +object(class@anonymous%0%s:6$%x)#1 (0) { } diff --git a/Zend/tests/bug73816.phpt b/Zend/tests/bug73816.phpt index aea392be5e18..63c4c1039290 100644 --- a/Zend/tests/bug73816.phpt +++ b/Zend/tests/bug73816.phpt @@ -13,12 +13,12 @@ var_dump(anon()); var_dump(anon()); ?> ---EXPECT-- -object(class@anonymous)#1 (1) { +--EXPECTF-- +object(class@anonymous%0%s:1$%x)#1 (1) { ["prop1":"class@anonymous":private]=> NULL } -object(class@anonymous)#1 (1) { +object(class@anonymous%0%s:1$%x)#1 (1) { ["prop2":"class@anonymous":private]=> NULL } diff --git a/Zend/tests/constexpr/new_anon_class.phpt b/Zend/tests/constexpr/new_anon_class.phpt index 49fc120f6b92..75a62724d636 100644 --- a/Zend/tests/constexpr/new_anon_class.phpt +++ b/Zend/tests/constexpr/new_anon_class.phpt @@ -8,6 +8,6 @@ static $x = new class {}; var_dump($x); ?> ---EXPECT-- -object(class@anonymous)#1 (0) { +--EXPECTF-- +object(class@anonymous%0%s:3$%x)#1 (0) { } diff --git a/Zend/tests/partial_application/static_pfa_004.phpt b/Zend/tests/partial_application/static_pfa_004.phpt index 093430232d43..8c703e59ecc5 100644 --- a/Zend/tests/partial_application/static_pfa_004.phpt +++ b/Zend/tests/partial_application/static_pfa_004.phpt @@ -39,6 +39,6 @@ Closure [ function {closure:pfa:%s:13} ] { Error: Using $this when not in object context # Re-bound PFA -object(class@anonymous)#3 (0) { +object(class@anonymous%0%s:19$%x)#3 (0) { } bool(true) diff --git a/Zend/tests/property_hooks/oss_fuzz_403308724.phpt b/Zend/tests/property_hooks/oss_fuzz_403308724.phpt index b27b08dd703b..a01773e10643 100644 --- a/Zend/tests/property_hooks/oss_fuzz_403308724.phpt +++ b/Zend/tests/property_hooks/oss_fuzz_403308724.phpt @@ -19,10 +19,10 @@ $y = $test->y; var_dump($y); var_dump($y[0]->inner); ?> ---EXPECT-- +--EXPECTF-- array(2) { [0]=> - object(class@anonymous)#2 (0) { + object(class@anonymous%0%s:8$%x)#2 (0) { } [1]=> int(1) diff --git a/Zend/tests/type_declarations/typed_properties_001.phpt b/Zend/tests/type_declarations/typed_properties_001.phpt index ce791cd4b56e..3605e6aa7236 100644 --- a/Zend/tests/type_declarations/typed_properties_001.phpt +++ b/Zend/tests/type_declarations/typed_properties_001.phpt @@ -21,7 +21,7 @@ var_dump(new class(1, 2.2, true, ["four"], new stdClass) { }); ?> --EXPECTF-- -object(class@anonymous)#%d (6) { +object(class@anonymous%0%s:2$%x)#1 (6) { ["int"]=> int(1) ["float"]=> diff --git a/Zend/tests/type_declarations/typed_properties_033.phpt b/Zend/tests/type_declarations/typed_properties_033.phpt index 665026f07565..dd97d14d83b7 100644 --- a/Zend/tests/type_declarations/typed_properties_033.phpt +++ b/Zend/tests/type_declarations/typed_properties_033.phpt @@ -26,7 +26,7 @@ var_dump($foo); ?> --EXPECTF-- Cannot assign float to reference held by property class@anonymous::$qux of type int -object(class@anonymous)#1 (4) { +object(class@anonymous%0%s:2$%x)#1 (4) { ["foo"]=> int(2) ["bar"]=> diff --git a/Zend/tests/type_declarations/typed_properties_034.phpt b/Zend/tests/type_declarations/typed_properties_034.phpt index 4af6baa80aef..be5896f21e3e 100644 --- a/Zend/tests/type_declarations/typed_properties_034.phpt +++ b/Zend/tests/type_declarations/typed_properties_034.phpt @@ -36,14 +36,14 @@ try { var_dump($foo); ?> ---EXPECT-- +--EXPECTF-- int(42) Cannot assign null to property class@anonymous::$baz of type int int(1) int(10) int(10) Cannot assign null to reference held by property class@anonymous::$baz of type int -object(class@anonymous)#1 (2) { +object(class@anonymous%0%s:2$%x)#1 (2) { ["bar"]=> &int(10) ["baz"]=> diff --git a/Zend/tests/type_declarations/typed_properties_037.phpt b/Zend/tests/type_declarations/typed_properties_037.phpt index 87efa3317a0a..20b21c03f231 100644 --- a/Zend/tests/type_declarations/typed_properties_037.phpt +++ b/Zend/tests/type_declarations/typed_properties_037.phpt @@ -9,7 +9,7 @@ $foo = new class { var_dump($foo); ?> --EXPECTF-- -object(class@anonymous)#%d (1) { +object(class@anonymous%0%s:2$%x)#1 (1) { ["bar"]=> int(10) ["qux"]=> diff --git a/Zend/tests/type_declarations/typed_properties_038.phpt b/Zend/tests/type_declarations/typed_properties_038.phpt index 4bb5b75a28fe..87b2504a9e9d 100644 --- a/Zend/tests/type_declarations/typed_properties_038.phpt +++ b/Zend/tests/type_declarations/typed_properties_038.phpt @@ -41,22 +41,22 @@ var_dump($foo); ?> --EXPECTF-- string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value" -object(class@anonymous)#1 (1) { +object(class@anonymous%0%s:3$%x)#1 (1) { ["bar"]=> int(%d) } string(65) "Cannot assign float to property class@anonymous::$bar of type int" -object(class@anonymous)#1 (1) { +object(class@anonymous%0%s:3$%x)#1 (1) { ["bar"]=> int(%d) } string(82) "Cannot increment property class@anonymous::$bar of type int past its maximal value" -object(class@anonymous)#1 (1) { +object(class@anonymous%0%s:3$%x)#1 (1) { ["bar"]=> int(%d) } string(65) "Cannot assign float to property class@anonymous::$bar of type int" -object(class@anonymous)#1 (1) { +object(class@anonymous%0%s:3$%x)#1 (1) { ["bar"]=> int(%d) } diff --git a/Zend/zend.c b/Zend/zend.c index b1ad3f4fe7f3..9c82f7d27b23 100644 --- a/Zend/zend.c +++ b/Zend/zend.c @@ -1895,12 +1895,11 @@ ZEND_API ZEND_COLD void zend_argument_count_error(const char *format, ...) /* {{ ZEND_API ZEND_COLD void zend_value_error(const char *format, ...) /* {{{ */ { va_list va; - char *message = NULL; va_start(va, format); - zend_vspprintf(&message, 0, format, va); - zend_throw_exception(zend_ce_value_error, message, 0); - efree(message); + zend_string *message = zend_vstrpprintf(0, format, va); + zend_throw_exception_ex(zend_ce_value_error, 0, "%pS", message); + zend_string_release(message); va_end(va); } /* }}} */ diff --git a/Zend/zend_API.c b/Zend/zend_API.c index de3570c5e848..206ce3abf9eb 100644 --- a/Zend/zend_API.c +++ b/Zend/zend_API.c @@ -380,7 +380,6 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_error_variadic( { zend_string *func_name; const char *arg_name; - char *message = NULL; if (EG(exception)) { return; } @@ -388,12 +387,12 @@ ZEND_API ZEND_COLD void ZEND_FASTCALL zend_argument_error_variadic( func_name = get_function_or_method_name(function); arg_name = get_function_arg_name(function, arg_num); - zend_vspprintf(&message, 0, format, va); - zend_throw_error(error_ce, "%s(): Argument #%d%s%s%s %s", + zend_string *message = zend_vstrpprintf(0, format, va); + zend_throw_error(error_ce, "%s(): Argument #%d%s%s%s %pS", ZSTR_VAL(func_name), arg_num, arg_name ? " ($" : "", arg_name ? arg_name : "", arg_name ? ")" : "", message ); - efree(message); + zend_string_release(message); zend_string_release(func_name); } diff --git a/ext/opcache/tests/bug78937_1.phpt b/ext/opcache/tests/bug78937_1.phpt index 657b306d68d4..be222ccd97c6 100644 --- a/ext/opcache/tests/bug78937_1.phpt +++ b/ext/opcache/tests/bug78937_1.phpt @@ -19,5 +19,5 @@ var_dump(foo()); ?> --EXPECTF-- Warning: Can't preload unlinked class Bar@anonymous: Unknown parent Bar in %spreload_bug78937.inc on line 3 -object(Bar@anonymous)#%d (0) { +object(Bar@anonymous%0%s:3$%x)#1 (0) { } diff --git a/ext/opcache/tests/bug78937_2.phpt b/ext/opcache/tests/bug78937_2.phpt index eb359cee96be..82f82681fd4b 100644 --- a/ext/opcache/tests/bug78937_2.phpt +++ b/ext/opcache/tests/bug78937_2.phpt @@ -20,5 +20,5 @@ var_dump(foo()); ?> --EXPECTF-- Warning: Can't preload unlinked class Bar@anonymous: Unknown parent Bar in %spreload_bug78937.inc on line 3 -object(Bar@anonymous)#%d (0) { +object(Bar@anonymous%0%s:3$%x)#1 (0) { } diff --git a/ext/opcache/tests/preload_008.phpt b/ext/opcache/tests/preload_008.phpt index c6ae2ce1d3b0..c6869083f8b8 100644 --- a/ext/opcache/tests/preload_008.phpt +++ b/ext/opcache/tests/preload_008.phpt @@ -15,6 +15,6 @@ if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows ---EXPECT-- -object(class@anonymous)#1 (0) { +--EXPECTF-- +object(class@anonymous%0%s:65$%x)#1 (0) { } diff --git a/ext/reflection/tests/ReflectionGenerator_basic.phpt b/ext/reflection/tests/ReflectionGenerator_basic.phpt index f215bf4c0dd1..76526fdd0736 100644 --- a/ext/reflection/tests/ReflectionGenerator_basic.phpt +++ b/ext/reflection/tests/ReflectionGenerator_basic.phpt @@ -59,7 +59,7 @@ array(2) { ["class"]=> string(%d) "class@anonymous%s" ["object"]=> - object(class@anonymous)#%d (0) { + object(class@anonymous%0%s:8$%x)#1 (0) { } ["type"]=> string(2) "->" @@ -80,7 +80,7 @@ object(ReflectionMethod)#8 (2) { ["class"]=> string(%d) "class@anonymous%s" } -object(class@anonymous)#1 (0) { +object(class@anonymous%0%s:8$%x)#1 (0) { } object(Generator)#%d (1) { ["function"]=> diff --git a/ext/standard/basic_functions.c b/ext/standard/basic_functions.c index a87ab1b5ad62..befe068cc0ed 100644 --- a/ext/standard/basic_functions.c +++ b/ext/standard/basic_functions.c @@ -1884,7 +1884,7 @@ PHP_FUNCTION(ini_parse_quantity) RETVAL_LONG(zend_ini_parse_quantity(shorthand, &errstr)); if (errstr) { - zend_error(E_WARNING, "%s", ZSTR_VAL(errstr)); + zend_error(E_WARNING, "%pS", errstr); zend_string_release(errstr); } } @@ -1930,7 +1930,7 @@ PHP_FUNCTION(ini_get_all) if (extname) { if ((module = zend_hash_find_ptr(&module_registry, extname)) == NULL) { - php_error_docref(NULL, E_WARNING, "Extension \"%s\" cannot be found", ZSTR_VAL(extname)); + php_error_docref(NULL, E_WARNING, "Extension \"%pS\" cannot be found", extname); RETURN_FALSE; } module_number = module->module_number; @@ -2401,7 +2401,7 @@ PHP_FUNCTION(move_uploaded_file) if (successful) { zend_hash_del(SG(rfc1867_uploaded_files), path); } else { - php_error_docref(NULL, E_WARNING, "Unable to move \"%s\" to \"%s\"", ZSTR_VAL(path), ZSTR_VAL(new_path)); + php_error_docref(NULL, E_WARNING, "Unable to move \"%pS\" to \"%pS\"", path, new_path); } RETURN_BOOL(successful); diff --git a/ext/standard/browscap.c b/ext/standard/browscap.c index 7534615a946b..742fadad562e 100644 --- a/ext/standard/browscap.c +++ b/ext/standard/browscap.c @@ -334,8 +334,8 @@ static void php_browscap_parser_cb(zval *arg1, zval *arg2, zval *arg3, int callb zend_string_equals_ci(ctx->current_section_name, Z_STR_P(arg2)) ) { zend_error(E_CORE_ERROR, "Invalid browscap ini file: " - "'Parent' value cannot be same as the section name: %s " - "(in file %s)", ZSTR_VAL(ctx->current_section_name), zend_ini_string_literal("browscap")); + "'Parent' value cannot be same as the section name: %pS " + "(in file %s)", ctx->current_section_name, zend_ini_string_literal("browscap")); return; } diff --git a/ext/standard/filestat.c b/ext/standard/filestat.c index 96669a809346..f7017b56e556 100644 --- a/ext/standard/filestat.c +++ b/ext/standard/filestat.c @@ -355,7 +355,7 @@ static void php_do_chgrp(INTERNAL_FUNCTION_PARAMETERS, int do_lchgrp) /* {{{ */ #else if (group_str) { if (php_get_gid_by_name(ZSTR_VAL(group_str), &gid) != SUCCESS) { - php_error_docref(NULL, E_WARNING, "Unable to find gid for %s", ZSTR_VAL(group_str)); + php_error_docref(NULL, E_WARNING, "Unable to find gid for %pS", group_str); RETURN_FALSE; } } else { @@ -493,7 +493,7 @@ static void php_do_chown(INTERNAL_FUNCTION_PARAMETERS, int do_lchown) /* {{{ */ if (user_str) { if (php_get_uid_by_name(ZSTR_VAL(user_str), &uid) != SUCCESS) { - php_error_docref(NULL, E_WARNING, "Unable to find uid for %s", ZSTR_VAL(user_str)); + php_error_docref(NULL, E_WARNING, "Unable to find uid for %pS", user_str); RETURN_FALSE; } } else { @@ -808,7 +808,7 @@ PHPAPI void php_stat(zend_string *filename, int type, zval *return_value) || wrapper->wops->url_stat(wrapper, local, flags | PHP_STREAM_URL_STAT_IGNORE_OPEN_BASEDIR, &ssb, NULL)) { /* Error Occurred */ if (!IS_EXISTS_CHECK(type)) { - php_error_docref(NULL, E_WARNING, "%sstat failed for %s", IS_LINK_OPERATION(type) ? "L" : "", ZSTR_VAL(filename)); + php_error_docref(NULL, E_WARNING, "%sstat failed for %pS", IS_LINK_OPERATION(type) ? "L" : "", filename); } RETURN_FALSE; } diff --git a/ext/standard/fsock.c b/ext/standard/fsock.c index 79d45b76396a..3b5fd62eabb8 100644 --- a/ext/standard/fsock.c +++ b/ext/standard/fsock.c @@ -77,7 +77,7 @@ static void php_fsockopen_stream(INTERNAL_FUNCTION_PARAMETERS, int persistent) if (persistent) { zend_string *escaped = php_stream_escape_persistent_key(host, host_len); - spprintf(&hashkey, 0, "pfsockopen__%s:" ZEND_LONG_FMT, ZSTR_VAL(escaped), port); + spprintf(&hashkey, 0, "pfsockopen__%pS:" ZEND_LONG_FMT, escaped, port); zend_string_release_ex(escaped, false); } diff --git a/ext/standard/ftp_fopen_wrapper.c b/ext/standard/ftp_fopen_wrapper.c index cf529e40085b..b90212d21b1b 100644 --- a/ext/standard/ftp_fopen_wrapper.c +++ b/ext/standard/ftp_fopen_wrapper.c @@ -149,7 +149,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char resource->port = 21; char *transport; - size_t transport_len = spprintf(&transport, 0, "tcp://%s:" ZEND_LONG_FMT, ZSTR_VAL(resource->host), resource->port); + size_t transport_len = spprintf(&transport, 0, "tcp://%pS:" ZEND_LONG_FMT, resource->host, resource->port); stream = php_stream_xport_create(transport, transport_len, REPORT_ERRORS, STREAM_XPORT_CLIENT | STREAM_XPORT_CONNECT, NULL, NULL, context, NULL, NULL); efree(transport); if (stream == NULL) { @@ -246,7 +246,7 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char PHP_FTP_CNTRL_CHK(ZSTR_VAL(resource->user), ZSTR_LEN(resource->user), "Invalid login %s") - php_stream_printf(stream, "USER %s\r\n", ZSTR_VAL(resource->user)); + php_stream_printf(stream, "USER %pS\r\n", resource->user); } else { php_stream_write_string(stream, "USER anonymous\r\n"); } @@ -263,12 +263,12 @@ static php_stream *php_ftp_fopen_connect(php_stream_wrapper *wrapper, const char PHP_FTP_CNTRL_CHK(ZSTR_VAL(resource->password), ZSTR_LEN(resource->password), "Invalid password %s") - php_stream_printf(stream, "PASS %s\r\n", ZSTR_VAL(resource->password)); + php_stream_printf(stream, "PASS %pS\r\n", resource->password); } else { /* if the user has configured who they are, send that as the password */ if (FG(from_address)) { - php_stream_printf(stream, "PASS %s\r\n", ZSTR_VAL(FG(from_address))); + php_stream_printf(stream, "PASS %pS\r\n", FG(from_address)); } else { php_stream_write_string(stream, "PASS anonymous\r\n"); } @@ -470,7 +470,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa goto errexit; /* find out the size of the file (verifying it exists) */ - php_stream_printf(stream, "SIZE %s\r\n", ZSTR_VAL(resource->path)); + php_stream_printf(stream, "SIZE %pS\r\n", resource->path); /* read the response */ result = GET_FTP_RESULT(stream); @@ -499,7 +499,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa if (allow_overwrite) { /* Context permits overwriting file, so we just delete whatever's there in preparation */ - php_stream_printf(stream, "DELE %s\r\n", ZSTR_VAL(resource->path)); + php_stream_printf(stream, "DELE %pS\r\n", resource->path); result = GET_FTP_RESULT(stream); if (result >= 300 || result <= 199) { goto errexit; @@ -606,7 +606,7 @@ php_stream * php_stream_url_wrap_ftp(php_stream_wrapper *wrapper, const char *pa if (error_message) { php_stream_wrapper_log_warn(wrapper, context, options, NetworkSendFailed, - "Failed to set up data channel: %s", ZSTR_VAL(error_message)); + "Failed to set up data channel: %pS", error_message); zend_string_release(error_message); } return NULL; @@ -927,7 +927,7 @@ static int php_stream_ftp_unlink(php_stream_wrapper *wrapper, const char *url, i } /* Attempt to delete the file */ - php_stream_printf(stream, "DELE %s\r\n", ZSTR_VAL(resource->path)); + php_stream_printf(stream, "DELE %pS\r\n", resource->path); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { @@ -995,12 +995,12 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr stream = php_ftp_fopen_connect(wrapper, url_from, "r", 0, NULL, context, NULL, NULL, NULL, NULL); if (!stream) { php_stream_wrapper_warn(wrapper, context, options, AuthFailed, - "Unable to connect to %s", ZSTR_VAL(resource_from->host)); + "Unable to connect to %pS", resource_from->host); goto rename_errexit; } /* Rename FROM */ - php_stream_printf(stream, "RNFR %s\r\n", ZSTR_VAL(resource_from->path)); + php_stream_printf(stream, "RNFR %pS\r\n", resource_from->path); result = GET_FTP_RESULT(stream); if (result < 300 || result > 399) { @@ -1010,7 +1010,7 @@ static int php_stream_ftp_rename(php_stream_wrapper *wrapper, const char *url_fr } /* Rename TO */ - php_stream_printf(stream, "RNTO %s\r\n", ZSTR_VAL(resource_to->path)); + php_stream_printf(stream, "RNTO %pS\r\n", resource_to->path); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { @@ -1058,7 +1058,7 @@ static int php_stream_ftp_mkdir(php_stream_wrapper *wrapper, const char *url, in } if (!recursive) { - php_stream_printf(stream, "MKD %s\r\n", ZSTR_VAL(resource->path)); + php_stream_printf(stream, "MKD %pS\r\n", resource->path); result = GET_FTP_RESULT(stream); } else { /* we look for directory separator from the end of string, thus hopefully reducing our work load */ @@ -1146,7 +1146,7 @@ static int php_stream_ftp_rmdir(php_stream_wrapper *wrapper, const char *url, in goto rmdir_errexit; } - php_stream_printf(stream, "RMD %s\r\n", ZSTR_VAL(resource->path)); + php_stream_printf(stream, "RMD %pS\r\n", resource->path); result = GET_FTP_RESULT(stream); if (result < 200 || result > 299) { diff --git a/ext/standard/head.c b/ext/standard/head.c index 34a22327b5e7..dae1f0924319 100644 --- a/ext/standard/head.c +++ b/ext/standard/head.c @@ -239,7 +239,7 @@ static zend_result php_head_parse_cookie_options_array(HashTable *options, zend_ } else if (zend_string_equals_literal_ci(key, "partitioned")) { *partitioned = zend_is_true(value); } else { - zend_value_error("%s(): option \"%s\" is invalid", get_active_function_name(), ZSTR_VAL(key)); + zend_value_error("%s(): option \"%pS\" is invalid", get_active_function_name(), key); return FAILURE; } } ZEND_HASH_FOREACH_END(); diff --git a/ext/standard/http.c b/ext/standard/http.c index d65e7a8acaae..031a2b5d468c 100644 --- a/ext/standard/http.c +++ b/ext/standard/http.c @@ -71,7 +71,7 @@ static void php_url_encode_scalar(zval *scalar, smart_str *form_str, case IS_OBJECT: ZEND_ASSERT(Z_OBJCE_P(scalar)->ce_flags & ZEND_ACC_ENUM); if (Z_OBJCE_P(scalar)->enum_backing_type == IS_UNDEF) { - zend_value_error("Unbacked enum %s cannot be converted to a string", ZSTR_VAL(Z_OBJCE_P(scalar)->name)); + zend_value_error("Unbacked enum %pS cannot be converted to a string", Z_OBJCE_P(scalar)->name); return; } scalar = zend_enum_fetch_case_value(Z_OBJ_P(scalar)); @@ -256,7 +256,7 @@ static zend_result cache_request_parse_body_option(HashTable *options, zval *opt zend_string *errstr; result = zend_ini_parse_quantity(Z_STR_P(option), &errstr); if (errstr) { - zend_error(E_WARNING, "%s", ZSTR_VAL(errstr)); + zend_error(E_WARNING, "%pS", errstr); zend_string_release(errstr); } } else if (Z_TYPE_P(option) == IS_LONG) { @@ -313,7 +313,7 @@ static zend_result cache_request_parse_body_options(HashTable *options) break; } - zend_value_error("Invalid key \"%s\" in $options argument", ZSTR_VAL(key)); + zend_value_error("Invalid key \"%pS\" in $options argument", key); return FAILURE; } ZEND_HASH_FOREACH_END(); diff --git a/ext/standard/http_fopen_wrapper.c b/ext/standard/http_fopen_wrapper.c index 9301536458a6..475174b5c32c 100644 --- a/ext/standard/http_fopen_wrapper.c +++ b/ext/standard/http_fopen_wrapper.c @@ -455,7 +455,7 @@ static php_stream *php_stream_url_wrap_http_ex(php_stream_wrapper *wrapper, use_proxy = 1; transport_string = zend_string_copy(Z_STR_P(tmpzval)); } else { - transport_string = zend_strpprintf(0, "%s://%s:" ZEND_LONG_FMT, use_ssl ? "ssl" : "tcp", ZSTR_VAL(resource->host), resource->port); + transport_string = zend_strpprintf(0, "%s://%pS:" ZEND_LONG_FMT, use_ssl ? "ssl" : "tcp", resource->host, resource->port); } } diff --git a/ext/standard/info.c b/ext/standard/info.c index 2029679998db..097f5900bc32 100644 --- a/ext/standard/info.c +++ b/ext/standard/info.c @@ -135,7 +135,7 @@ PHPAPI ZEND_COLD void php_info_print_module(zend_module_entry *zend_module) /* { zend_string *url_name = php_url_encode(zend_module->name, strlen(zend_module->name)); zend_str_tolower(ZSTR_VAL(url_name), ZSTR_LEN(url_name)); - php_info_printf("

%s

\n", ZSTR_VAL(url_name), ZSTR_VAL(url_name), zend_module->name); + php_info_printf("

%s

\n", url_name, url_name, zend_module->name); efree(url_name); } else { diff --git a/ext/standard/mail.c b/ext/standard/mail.c index 6d85d06d1f6d..346ed940d8d7 100644 --- a/ext/standard/mail.c +++ b/ext/standard/mail.c @@ -131,7 +131,7 @@ static void php_mail_build_headers_elem(smart_str *s, const zend_string *key, zv switch(Z_TYPE_P(val)) { case IS_STRING: if (php_mail_build_headers_check_field_name(key) != SUCCESS) { - zend_value_error("Header name \"%s\" contains invalid characters", ZSTR_VAL(key)); + zend_value_error("Header name \"%pS\" contains invalid characters", key); return; } @@ -141,20 +141,20 @@ static void php_mail_build_headers_elem(smart_str *s, const zend_string *key, zv case NO_HEADER_ERROR: break; case CONTAINS_LF_ONLY: - zend_value_error("Header \"%s\" contains LF character that is not allowed in the header", ZSTR_VAL(key)); + zend_value_error("Header \"%pS\" contains LF character that is not allowed in the header", key); return; case CONTAINS_CR_ONLY: - zend_value_error("Header \"%s\" contains CR character that is not allowed in the header", ZSTR_VAL(key)); + zend_value_error("Header \"%pS\" contains CR character that is not allowed in the header", key); return; case CONTAINS_CRLF: - zend_value_error("Header \"%s\" contains CRLF characters that are used as a line separator and are not allowed in the header", ZSTR_VAL(key)); + zend_value_error("Header \"%pS\" contains CRLF characters that are used as a line separator and are not allowed in the header", key); return; case CONTAINS_NULL: - zend_value_error("Header \"%s\" contains NULL character that is not allowed in the header", ZSTR_VAL(key)); + zend_value_error("Header \"%pS\" contains NULL character that is not allowed in the header", key); return; default: // fallback - zend_value_error("Header \"%s\" has invalid format, or contains invalid characters", ZSTR_VAL(key)); + zend_value_error("Header \"%pS\" has invalid format, or contains invalid characters", key); return; } smart_str_append(s, key); @@ -166,7 +166,7 @@ static void php_mail_build_headers_elem(smart_str *s, const zend_string *key, zv php_mail_build_headers_elems(s, key, val); break; default: - zend_type_error("Header \"%s\" must be of type array|string, %s given", ZSTR_VAL(key), zend_zval_value_name(val)); + zend_type_error("Header \"%pS\" must be of type array|string, %s given", key, zend_zval_value_name(val)); } } @@ -178,12 +178,12 @@ static void php_mail_build_headers_elems(smart_str *s, const zend_string *key, z ZEND_HASH_FOREACH_STR_KEY_VAL(Z_ARRVAL_P(val), tmp_key, tmp_val) { if (tmp_key) { - zend_type_error("Header \"%s\" must only contain numeric keys, \"%s\" found", ZSTR_VAL(key), ZSTR_VAL(tmp_key)); + zend_type_error("Header \"%pS\" must only contain numeric keys, \"%pS\" found", key, tmp_key); break; } ZVAL_DEREF(tmp_val); if (Z_TYPE_P(tmp_val) != IS_STRING) { - zend_type_error("Header \"%s\" must only contain values of type string, %s found", ZSTR_VAL(key), zend_zval_value_name(tmp_val)); + zend_type_error("Header \"%pS\" must only contain values of type string, %s found", key, zend_zval_value_name(tmp_val)); break; } php_mail_build_headers_elem(s, key, tmp_val); @@ -201,7 +201,7 @@ do { \ } \ php_mail_build_headers_elems(&s, key, val); \ } else { \ - zend_type_error("Header \"%s\" must be of type array|string, %s given", ZSTR_VAL(key), zend_zval_value_name(val)); \ + zend_type_error("Header \"%pS\" must be of type array|string, %s given", key, zend_zval_value_name(val)); \ } \ } while(0) diff --git a/ext/standard/proc_open.c b/ext/standard/proc_open.c index beeb157e53a5..4d4ae0b7da8e 100644 --- a/ext/standard/proc_open.c +++ b/ext/standard/proc_open.c @@ -938,7 +938,7 @@ static zend_result set_proc_descriptor_to_socket(descriptorspec_item *desc) if (create_socketpair(sock)) { zend_string *err = php_socket_error_str(php_socket_errno()); - php_error_docref(NULL, E_WARNING, "Unable to create socket pair: %s", ZSTR_VAL(err)); + php_error_docref(NULL, E_WARNING, "Unable to create socket pair: %pS", err); zend_string_release(err); return FAILURE; } @@ -1091,7 +1091,7 @@ static zend_result set_proc_descriptor_from_array(const HashTable *ht, descripto /* Set descriptor to slave end of PTY */ retval = set_proc_descriptor_to_pty(&descriptors[ndesc], pty_master_fd, pty_slave_fd); } else { - php_error_docref(NULL, E_WARNING, "%s is not a valid descriptor spec/mode", ZSTR_VAL(ztype)); + php_error_docref(NULL, E_WARNING, "%pS is not a valid descriptor spec/mode", ztype); goto finish; } diff --git a/ext/standard/streamsfuncs.c b/ext/standard/streamsfuncs.c index d544e8bf5f0f..f01f316a3acd 100644 --- a/ext/standard/streamsfuncs.c +++ b/ext/standard/streamsfuncs.c @@ -179,7 +179,7 @@ PHP_FUNCTION(stream_socket_client) /* host might contain binary characters */ zend_string *quoted_host = php_addslashes(host); - php_error_docref(NULL, E_WARNING, "Unable to connect to %s (%s)", ZSTR_VAL(quoted_host), errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr)); + php_error_docref(NULL, E_WARNING, "Unable to connect to %pS (%s)", quoted_host, errstr == NULL ? "Unknown error" : ZSTR_VAL(errstr)); zend_string_release_ex(quoted_host, 0); } diff --git a/ext/standard/string.c b/ext/standard/string.c index d8a7479d2a98..3445abf1800d 100644 --- a/ext/standard/string.c +++ b/ext/standard/string.c @@ -1274,7 +1274,7 @@ PHP_FUNCTION(str_decrement) RETURN_THROWS(); } if (ZSTR_LEN(str) >= 1 && ZSTR_VAL(str)[0] == '0') { - zend_argument_value_error(1, "\"%s\" is out of decrement range", ZSTR_VAL(str)); + zend_argument_value_error(1, "\"%pS\" is out of decrement range", str); RETURN_THROWS(); } @@ -1301,7 +1301,7 @@ PHP_FUNCTION(str_decrement) if (UNEXPECTED(carry || (ZSTR_VAL(decremented)[0] == '0' && ZSTR_LEN(decremented) > 1))) { if (ZSTR_LEN(decremented) == 1) { zend_string_efree(decremented); - zend_argument_value_error(1, "\"%s\" is out of decrement range", ZSTR_VAL(str)); + zend_argument_value_error(1, "\"%pS\" is out of decrement range", str); RETURN_THROWS(); } zend_string *tmp = zend_string_alloc(ZSTR_LEN(decremented) - 1, 0); diff --git a/ext/standard/tests/array/compact_this.phpt b/ext/standard/tests/array/compact_this.phpt index f3677e03e276..9bf8394c6b54 100644 --- a/ext/standard/tests/array/compact_this.phpt +++ b/ext/standard/tests/array/compact_this.phpt @@ -28,19 +28,19 @@ var_dump( ); ?> ---EXPECT-- +--EXPECTF-- array(1) { ["this"]=> - object(class@anonymous)#1 (0) { + object(class@anonymous%0%s:4$%x)#1 (0) { } } array(1) { ["this"]=> - object(class@anonymous)#1 (0) { + object(class@anonymous%0%s:12$%x)#1 (0) { } } array(1) { ["this"]=> - object(class@anonymous)#1 (0) { + object(class@anonymous%0%s:20$%x)#1 (0) { } } diff --git a/ext/standard/tests/class_object/get_object_vars_variation_004.phpt b/ext/standard/tests/class_object/get_object_vars_variation_004.phpt index 84827134c1b1..324b5b4a39a2 100644 --- a/ext/standard/tests/class_object/get_object_vars_variation_004.phpt +++ b/ext/standard/tests/class_object/get_object_vars_variation_004.phpt @@ -32,7 +32,7 @@ array(4) { [12]=> int(6) ["test"]=> - object(JsonSerializable@anonymous)#2 (0) { + object(JsonSerializable@anonymous%0%s:8$%x)#2 (0) { } } array(4) { @@ -43,6 +43,6 @@ array(4) { [12]=> int(6) ["test"]=> - object(JsonSerializable@anonymous)#2 (0) { + object(JsonSerializable@anonymous%0%s:8$%x)#2 (0) { } } diff --git a/ext/standard/tests/file/fscanf_error.phpt b/ext/standard/tests/file/fscanf_error.phpt index da586555be06..aceeeffdcdb9 100644 --- a/ext/standard/tests/file/fscanf_error.phpt +++ b/ext/standard/tests/file/fscanf_error.phpt @@ -55,14 +55,14 @@ $file_path = __DIR__; $filename = "$file_path/fscanf_error.tmp"; unlink($filename); ?> ---EXPECT-- +--EXPECTF-- *** Testing fscanf() for error conditions *** fscanf(): supplied resource is not a valid File-Handle resource Different numbers of variable names and field specifiers array(0) { } -Bad scan conversion character " -Bad scan conversion character " +Bad scan conversion character "%0" +Bad scan conversion character "%0" Bad scan conversion character "." Bad scan conversion character "m" diff --git a/ext/standard/tests/general_functions/debug_zval_dump_gh19801_memory_leak.phpt b/ext/standard/tests/general_functions/debug_zval_dump_gh19801_memory_leak.phpt index cf2f1d444f1d..f8e30d599353 100644 --- a/ext/standard/tests/general_functions/debug_zval_dump_gh19801_memory_leak.phpt +++ b/ext/standard/tests/general_functions/debug_zval_dump_gh19801_memory_leak.phpt @@ -25,7 +25,7 @@ object(stdClass)#2 (1) refcount(%d){ reference refcount(%d) { array(1) packed refcount(%d){ [0]=> - object(class@anonymous)#1 (0) refcount(%d){ + object(class@anonymous%0%s:4$%x)#1 (0) refcount(%d){ } } } diff --git a/ext/standard/tests/general_functions/var_dump_gh19801_memory_leak.phpt b/ext/standard/tests/general_functions/var_dump_gh19801_memory_leak.phpt index f0522916de4e..e0640e97cbea 100644 --- a/ext/standard/tests/general_functions/var_dump_gh19801_memory_leak.phpt +++ b/ext/standard/tests/general_functions/var_dump_gh19801_memory_leak.phpt @@ -24,7 +24,7 @@ object(stdClass)#2 (1) { ["a"]=> &array(1) { [0]=> - object(class@anonymous)#1 (0) { + object(class@anonymous%0%s:4$%x)#1 (0) { } } } diff --git a/ext/standard/tests/mail/mail_basic7.phpt b/ext/standard/tests/mail/mail_basic7.phpt index ffc3fd241f00..4523ced29fb8 100644 --- a/ext/standard/tests/mail/mail_basic7.phpt +++ b/ext/standard/tests/mail/mail_basic7.phpt @@ -207,7 +207,7 @@ try { } ?> ---EXPECT-- +--EXPECTF-- *** Testing mail() : basic functionality *** @@ -250,8 +250,8 @@ TypeError: Header "foo7" must only contain values of type string, stdClass found ************* TEST ****************** ValueError: Header name "*:foo1" contains invalid characters ValueError: Header name "foo2:::" contains invalid characters -ValueError: Header name "" contains invalid characters -ValueError: Header name "foo7" contains invalid characters +ValueError: Header name "%0foo6" contains invalid characters +ValueError: Header name "foo7%0" contains invalid characters bool(true) To: user@example.com Subject: Test Subject diff --git a/ext/standard/tests/serialize/bug81111.phpt b/ext/standard/tests/serialize/bug81111.phpt index aa5002eaf704..de4a8ea856f8 100644 --- a/ext/standard/tests/serialize/bug81111.phpt +++ b/ext/standard/tests/serialize/bug81111.phpt @@ -46,7 +46,7 @@ try { ?> --EXPECTF-- Serialization of 'MySplFileInfo' is not allowed -Serialization of 'class@anonymous' is not allowed +Serialization of 'class@anonymous%0%s:14$%x' is not allowed Unserialization of 'MySplFileInfo' is not allowed Unserialization of 'MySplFileInfo' is not allowed diff --git a/ext/standard/tests/serialize/unserialize_allowed_classes_option_invalid_class_names.phpt b/ext/standard/tests/serialize/unserialize_allowed_classes_option_invalid_class_names.phpt index 74997939817d..307407605704 100644 --- a/ext/standard/tests/serialize/unserialize_allowed_classes_option_invalid_class_names.phpt +++ b/ext/standard/tests/serialize/unserialize_allowed_classes_option_invalid_class_names.phpt @@ -40,9 +40,9 @@ try { } ?> ---EXPECT-- +--EXPECTF-- ValueError: unserialize(): Option "allowed_classes" must be an array of class names, " whitespace " given ValueError: unserialize(): Option "allowed_classes" must be an array of class names, "name with whitespace" given ValueError: unserialize(): Option "allowed_classes" must be an array of class names, "$dollars" given -ValueError: unserialize(): Option "allowed_classes" must be an array of class names, "have" given +ValueError: unserialize(): Option "allowed_classes" must be an array of class names, "have%0nul_byte" given diff --git a/ext/standard/var.c b/ext/standard/var.c index f94c1cf09584..899ddd71c9a2 100644 --- a/ext/standard/var.c +++ b/ext/standard/var.c @@ -89,8 +89,8 @@ static void php_object_property_dump(zend_property_info *prop_info, zval *zv, ze if (Z_TYPE_P(zv) == IS_UNDEF) { ZEND_ASSERT(ZEND_TYPE_IS_SET(prop_info->type)); zend_string *type_str = zend_type_to_string(prop_info->type); - php_printf("%*cuninitialized(%s)\n", - level + 1, ' ', ZSTR_VAL(type_str)); + php_printf("%*cuninitialized(%pS)\n", + level + 1, ' ', type_str); zend_string_release(type_str); } else { php_var_dump(zv, level + 2); @@ -174,7 +174,7 @@ PHPAPI void php_var_dump(zval *struc, int level) /* {{{ */ zend_class_entry *ce = Z_OBJCE_P(struc); if ((ce->ce_flags & ZEND_ACC_ENUM) && ce->__debugInfo == NULL) { zval *case_name_zval = zend_enum_fetch_case_name(Z_OBJ_P(struc)); - php_printf("%senum(%s::%s)\n", COMMON, ZSTR_VAL(ce->name), Z_STRVAL_P(case_name_zval)); + php_printf("%senum(%pS::%pS)\n", COMMON, ce->name, Z_STR_P(case_name_zval)); return; } zend_object *zobj = Z_OBJ_P(struc); @@ -188,12 +188,12 @@ PHPAPI void php_var_dump(zval *struc, int level) /* {{{ */ myht = zend_get_properties_for(struc, ZEND_PROP_PURPOSE_DEBUG); if (ce->ce_flags & ZEND_ACC_ENUM) { zval *case_name_zval = zend_enum_fetch_case_name(Z_OBJ_P(struc)); - php_printf("%senum(%s::%s) (%d) {\n", COMMON, ZSTR_VAL(ce->name), Z_STRVAL_P(case_name_zval), myht ? zend_array_count(myht) : 0); + php_printf("%senum(%pS::%pS) (%d) {\n", COMMON, ce->name, Z_STR_P(case_name_zval), myht ? zend_array_count(myht) : 0); } else { class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc)); const char *prefix = php_var_dump_object_prefix(Z_OBJ_P(struc)); - php_printf("%s%sobject(%s)#%d (%d) {\n", COMMON, prefix, ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(struc), myht ? zend_array_count(myht) : 0); + php_printf("%s%sobject(%pS)#%d (%d) {\n", COMMON, prefix, class_name, Z_OBJ_HANDLE_P(struc), myht ? zend_array_count(myht) : 0); zend_string_release_ex(class_name, 0); } @@ -309,8 +309,8 @@ static void zval_object_property_dump(zend_property_info *prop_info, zval *zv, z } if (prop_info && Z_TYPE_P(zv) == IS_UNDEF) { zend_string *type_str = zend_type_to_string(prop_info->type); - php_printf("%*cuninitialized(%s)\n", - level + 1, ' ', ZSTR_VAL(type_str)); + php_printf("%*cuninitialized(%pS)\n", + level + 1, ' ', type_str); zend_string_release(type_str); } else { php_debug_zval_dump(zv, level + 2); @@ -404,7 +404,7 @@ PHPAPI void php_debug_zval_dump(zval *struc, int level) /* {{{ */ class_name = Z_OBJ_HANDLER_P(struc, get_class_name)(Z_OBJ_P(struc)); const char *prefix = php_var_dump_object_prefix(Z_OBJ_P(struc)); - php_printf("%sobject(%s)#%d (%d) refcount(%u){\n", prefix, ZSTR_VAL(class_name), Z_OBJ_HANDLE_P(struc), myht ? zend_array_count(myht) : 0, Z_REFCOUNT_P(struc)); + php_printf("%sobject(%pS)#%d (%d) refcount(%u){\n", prefix, class_name, Z_OBJ_HANDLE_P(struc), myht ? zend_array_count(myht) : 0, Z_REFCOUNT_P(struc)); zend_string_release_ex(class_name, 0); if (myht) { ZEND_HASH_FOREACH_KEY_VAL(myht, index, key, val) { @@ -864,7 +864,7 @@ static HashTable* php_var_serialize_call_sleep(zend_object *obj, zend_function * if (Z_TYPE(retval) != IS_ARRAY) { zval_ptr_dtor(&retval); - php_error_docref(NULL, E_WARNING, "%s::__sleep() should return an array only containing the names of instance-variables to serialize", ZSTR_VAL(obj->ce->name)); + php_error_docref(NULL, E_WARNING, "%pS::__sleep() should return an array only containing the names of instance-variables to serialize", obj->ce->name); return NULL; } @@ -886,7 +886,7 @@ static int php_var_serialize_call_magic_serialize(zval *retval, zval *obj) /* {{ if (Z_TYPE_P(retval) != IS_ARRAY) { zval_ptr_dtor(retval); - zend_type_error("%s::__serialize() must return an array", ZSTR_VAL(Z_OBJCE_P(obj)->name)); + zend_type_error("%pS::__serialize() must return an array", Z_OBJCE_P(obj)->name); return FAILURE; } @@ -915,7 +915,7 @@ static int php_var_serialize_try_add_sleep_prop( if (!zend_hash_add(ht, name, val)) { php_error_docref(NULL, E_WARNING, - "\"%s\" is returned from __sleep() multiple times", ZSTR_VAL(error_name)); + "\"%pS\" is returned from __sleep() multiple times", error_name); return SUCCESS; } @@ -941,8 +941,8 @@ static int php_var_serialize_get_sleep_props( ZVAL_DEREF(name_val); if (Z_TYPE_P(name_val) != IS_STRING) { php_error_docref(NULL, E_WARNING, - "%s::__sleep() should return an array only containing the names of instance-variables to serialize", - ZSTR_VAL(ce->name)); + "%pS::__sleep() should return an array only containing the names of instance-variables to serialize", + ce->name); } name = zval_get_tmp_string(name_val, &tmp_name); @@ -989,7 +989,7 @@ static int php_var_serialize_get_sleep_props( } php_error_docref(NULL, E_WARNING, - "\"%s\" returned as member variable from __sleep() but does not exist", ZSTR_VAL(name)); + "\"%pS\" returned as member variable from __sleep() but does not exist", name); zend_tmp_string_release(tmp_name); } ZEND_HASH_FOREACH_END(); @@ -1137,8 +1137,8 @@ static void php_var_serialize_intern(smart_str *buf, zval *struc, php_serialize_ uint32_t count; if (ce->ce_flags & ZEND_ACC_NOT_SERIALIZABLE) { - zend_throw_exception_ex(NULL, 0, "Serialization of '%s' is not allowed", - ZSTR_VAL(ce->name)); + zend_throw_exception_ex(NULL, 0, "Serialization of '%pS' is not allowed", + ce->name); return; } @@ -1450,7 +1450,7 @@ PHPAPI void php_unserialize_with_options(zval *return_value, const char *buf, co goto cleanup; } if (UNEXPECTED(!zend_is_valid_class_name(name))) { - zend_value_error("%s(): Option \"allowed_classes\" must be an array of class names, \"%s\" given", function_name, ZSTR_VAL(name)); + zend_value_error("%s(): Option \"allowed_classes\" must be an array of class names, \"%pS\" given", function_name, name); zend_tmp_string_release(tmp_str); goto cleanup; } diff --git a/ext/standard/var_unserializer.re b/ext/standard/var_unserializer.re index eca9660c5605..d6ec51c47171 100644 --- a/ext/standard/var_unserializer.re +++ b/ext/standard/var_unserializer.re @@ -570,8 +570,8 @@ static int is_property_visibility_changed(zend_class_entry *ce, zval *key) return 1; } else { php_error_docref(NULL, E_WARNING, - "Cannot unserialize value for virtual property %s::$%s", - ZSTR_VAL(existing_propinfo->ce->name), Z_STRVAL_P(key)); + "Cannot unserialize value for virtual property %pS::$%pS", + existing_propinfo->ce->name, Z_STR_P(key)); zval_ptr_dtor_str(key); return -1; } @@ -650,13 +650,13 @@ declared_property: if (EXPECTED(!ret)) { if (UNEXPECTED(obj->ce->ce_flags & ZEND_ACC_NO_DYNAMIC_PROPERTIES)) { - zend_throw_error(NULL, "Cannot create dynamic property %s::$%s", - ZSTR_VAL(obj->ce->name), zend_get_unmangled_property_name(Z_STR_P(&key))); + zend_throw_error(NULL, "Cannot create dynamic property %pS::$%s", + obj->ce->name, zend_get_unmangled_property_name(Z_STR_P(&key))); zval_ptr_dtor_str(&key); goto failure; } else if (!(obj->ce->ce_flags & ZEND_ACC_ALLOW_DYNAMIC_PROPERTIES)) { - zend_error(E_DEPRECATED, "Creation of dynamic property %s::$%s is deprecated", - ZSTR_VAL(obj->ce->name), zend_get_unmangled_property_name(Z_STR_P(&key))); + zend_error(E_DEPRECATED, "Creation of dynamic property %pS::$%s is deprecated", + obj->ce->name, zend_get_unmangled_property_name(Z_STR_P(&key))); if (EG(exception)) { zval_ptr_dtor_str(&key); goto failure; @@ -777,7 +777,7 @@ static inline int object_custom(UNSERIALIZE_PARAMETER, zend_class_entry *ce) } if (ce->unserialize == NULL) { - zend_error(E_WARNING, "Class %s has no unserializer", ZSTR_VAL(ce->name)); + zend_error(E_WARNING, "Class %pS has no unserializer", ce->name); return 0; } else if (ce->unserialize(rval, ce, (const unsigned char*)*p, datalen, (zend_unserialize_data *)var_hash) != SUCCESS) { return 0; @@ -1273,7 +1273,7 @@ object ":" uiv ":" ["] { /* The callback function may have defined the class */ BG(serialize_lock)++; if ((ce = zend_lookup_class(class_name)) == NULL) { - php_error_docref(NULL, E_WARNING, "Function %s() hasn't defined the class it was called for", Z_STRVAL(user_func)); + php_error_docref(NULL, E_WARNING, "Function %pS() hasn't defined the class it was called for", Z_STR(user_func)); incomplete_class = 1; ce = PHP_IC_ENTRY; } @@ -1285,8 +1285,8 @@ object ":" uiv ":" ["] { *p = YYCURSOR; if (ce->ce_flags & ZEND_ACC_NOT_SERIALIZABLE) { - zend_throw_exception_ex(NULL, 0, "Unserialization of '%s' is not allowed", - ZSTR_VAL(ce->name)); + zend_throw_exception_ex(NULL, 0, "Unserialization of '%pS' is not allowed", + ce->name); zend_string_release_ex(class_name, 0); return 0; } @@ -1336,7 +1336,7 @@ object ":" uiv ":" ["] { * there is both Serializable::unserialize() and __unserialize(), then both may be used, * depending on the serialization format. */ if (ce->serialize != NULL && !has_unserialize) { - zend_error(E_WARNING, "Erroneous data format for unserializing '%s'", ZSTR_VAL(ce->name)); + zend_error(E_WARNING, "Erroneous data format for unserializing '%pS'", ce->name); zend_string_release_ex(class_name, 0); return 0; } @@ -1392,11 +1392,11 @@ object ":" uiv ":" ["] { zend_class_entry *ce = zend_lookup_class(enum_name); if (!ce) { - php_error_docref(NULL, E_WARNING, "Class '%s' not found", ZSTR_VAL(enum_name)); + php_error_docref(NULL, E_WARNING, "Class '%pS' not found", enum_name); goto fail; } if (!(ce->ce_flags & ZEND_ACC_ENUM)) { - php_error_docref(NULL, E_WARNING, "Class '%s' is not an enum", ZSTR_VAL(enum_name)); + php_error_docref(NULL, E_WARNING, "Class '%pS' is not an enum", enum_name); goto fail; } @@ -1405,12 +1405,12 @@ object ":" uiv ":" ["] { zend_class_constant *c = zend_hash_find_ptr(CE_CONSTANTS_TABLE(ce), case_name); if (!c) { - php_error_docref(NULL, E_WARNING, "Undefined constant %s::%s", ZSTR_VAL(enum_name), ZSTR_VAL(case_name)); + php_error_docref(NULL, E_WARNING, "Undefined constant %pS::%pS", enum_name, case_name); goto fail; } if (!(ZEND_CLASS_CONST_FLAGS(c) & ZEND_CLASS_CONST_IS_CASE)) { - php_error_docref(NULL, E_WARNING, "%s::%s is not an enum case", ZSTR_VAL(enum_name), ZSTR_VAL(case_name)); + php_error_docref(NULL, E_WARNING, "%pS::%pS is not an enum case", enum_name, case_name); goto fail; }