Skip to content
Merged
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
2 changes: 1 addition & 1 deletion deepclone.c
Original file line number Diff line number Diff line change
Expand Up @@ -2100,7 +2100,7 @@ static void dc_copy_value(dc_ctx *ctx, zval *src, zval *dst, zval *mask_dst)
* ends must enable. */
if (func && (func->common.fn_flags & ZEND_ACC_FAKE_CLOSURE)) {
if (!ctx->allow_named_closures) {
zend_value_error("deepclone_to_array(): serializing a closure over the named callable \"%s\" requires enabling the allow_named_closures option", ZSTR_VAL(func->common.function_name));
zend_value_error("deepclone_to_array(): serializing a closure over the named callable \"%s\" requires enabling the \"allow_named_closures\" option; do it only if you trust the input", ZSTR_VAL(func->common.function_name));
return;
}
if (!dc_class_allowed(ctx->allowed_ht, zend_ce_closure->name)) {
Expand Down
2 changes: 1 addition & 1 deletion tests/deepclone_attribute_provenance.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -99,5 +99,5 @@ bool(true)
bool(true)
bool(true)
== 5. a callable no attribute declares stays by-name (needs the opt-in) ==
uncaptured: ValueError: deepclone_to_array(): serializing a closure over the named callable "loose" requires enabling the allow_named_closures option
uncaptured: ValueError: deepclone_to_array(): serializing a closure over the named callable "loose" requires enabling the "allow_named_closures" option; do it only if you trust the input
Done
2 changes: 1 addition & 1 deletion tests/deepclone_from_array.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ try {
deepclone_to_array(strlen(...));
echo "no throw\n";
} catch (ValueError $e) {
var_dump($e->getMessage() === 'deepclone_to_array(): serializing a closure over the named callable "strlen" requires enabling the allow_named_closures option');
var_dump($e->getMessage() === 'deepclone_to_array(): serializing a closure over the named callable "strlen" requires enabling the "allow_named_closures" option; do it only if you trust the input');
}
$clone = deepclone_from_array(deepclone_to_array(strlen(...), allow_named_closures: true), allow_named_closures: true);
var_dump($clone('hello') === 5);
Expand Down
4 changes: 2 additions & 2 deletions tests/deepclone_named_closure_optin.phpt
Original file line number Diff line number Diff line change
Expand Up @@ -89,8 +89,8 @@ bool(true)
bool(true)
bool(true)
== 3. a runtime named closure refuses to_array without the opt-in ==
strlen: ValueError: deepclone_to_array(): serializing a closure over the named callable "strlen" requires enabling the allow_named_closures option
Helper::pub: ValueError: deepclone_to_array(): serializing a closure over the named callable "pub" requires enabling the allow_named_closures option
strlen: ValueError: deepclone_to_array(): serializing a closure over the named callable "strlen" requires enabling the "allow_named_closures" option; do it only if you trust the input
Helper::pub: ValueError: deepclone_to_array(): serializing a closure over the named callable "pub" requires enabling the "allow_named_closures" option; do it only if you trust the input
== 4. with the opt-in on both ends it round-trips by name ==
bool(true)
bool(true)
Expand Down