Skip to content
Draft
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
4 changes: 2 additions & 2 deletions Zend/tests/anon/012.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ Ensure correct unmangling of private property names for anonymous class instance
<?php
var_dump(new class { private $foo; });
?>
--EXPECT--
object(class@anonymous)#1 (1) {
--EXPECTF--
object(class@anonymous%0%s:2$%x)#1 (1) {
["foo":"class@anonymous":private]=>
NULL
}
4 changes: 2 additions & 2 deletions Zend/tests/anon/013.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
4 changes: 2 additions & 2 deletions Zend/tests/bug72598.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
6 changes: 3 additions & 3 deletions Zend/tests/bug73816.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
4 changes: 2 additions & 2 deletions Zend/tests/constexpr/new_anon_class.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
2 changes: 1 addition & 1 deletion Zend/tests/partial_application/static_pfa_004.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ Closure [ <user> 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)
4 changes: 2 additions & 2 deletions Zend/tests/property_hooks/oss_fuzz_403308724.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/type_declarations/typed_properties_001.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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"]=>
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/type_declarations/typed_properties_033.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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"]=>
Expand Down
4 changes: 2 additions & 2 deletions Zend/tests/type_declarations/typed_properties_034.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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"]=>
Expand Down
2 changes: 1 addition & 1 deletion Zend/tests/type_declarations/typed_properties_037.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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"]=>
Expand Down
8 changes: 4 additions & 4 deletions Zend/tests/type_declarations/typed_properties_038.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
}
7 changes: 3 additions & 4 deletions Zend/zend.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
} /* }}} */

Expand Down
7 changes: 3 additions & 4 deletions Zend/zend_API.c
Original file line number Diff line number Diff line change
Expand Up @@ -380,20 +380,19 @@ 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;
}

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);
}

Expand Down
2 changes: 1 addition & 1 deletion ext/opcache/tests/bug78937_1.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
2 changes: 1 addition & 1 deletion ext/opcache/tests/bug78937_2.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) {
}
4 changes: 2 additions & 2 deletions ext/opcache/tests/preload_008.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,6 @@ if (PHP_OS_FAMILY == 'Windows') die('skip Preloading is not supported on Windows
<?php
var_dump(get_anon());
?>
--EXPECT--
object(class@anonymous)#1 (0) {
--EXPECTF--
object(class@anonymous%0%s:65$%x)#1 (0) {
}
4 changes: 2 additions & 2 deletions ext/reflection/tests/ReflectionGenerator_basic.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -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) "->"
Expand All @@ -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"]=>
Expand Down
6 changes: 3 additions & 3 deletions ext/standard/basic_functions.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
}
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions ext/standard/browscap.c
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}

Expand Down
6 changes: 3 additions & 3 deletions ext/standard/filestat.c
Original file line number Diff line number Diff line change
Expand Up @@ -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 {
Expand Down Expand Up @@ -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 {
Expand Down Expand Up @@ -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;
}
Expand Down
2 changes: 1 addition & 1 deletion ext/standard/fsock.c
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

Expand Down
Loading
Loading