Skip to content

Commit 11b0332

Browse files
Tweak error message
1 parent c838ae3 commit 11b0332

2 files changed

Lines changed: 4 additions & 4 deletions

File tree

deepclone.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4286,7 +4286,7 @@ PHP_FUNCTION(deepclone_from_array)
42864286
* is rejected wholesale rather than failing mid-hydration. */
42874287
if (!allow_named_closures
42884288
&& dc_payload_has_named_closure(zmask, zresolve, zref_masks, zstates)) {
4289-
DC_INVALID("deepclone_from_array(): resolving a closure over a named callable requires enabling the allow_named_closures option");
4289+
DC_INVALID("deepclone_from_array(): resolving a closure over a named callable requires enabling the \"allow_named_closures\" option; do it only if you trust the input; alternatively, install the "deepclone" extension, which can reference callables declared in constant expressions");
42904290
}
42914291

42924292
/* ── Build objectMeta ── */

tests/deepclone_named_closure_optin.phpt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,11 @@ bool(true)
9696
bool(true)
9797
bool(true)
9898
== 5. a by-name payload is refused by from_array without the opt-in ==
99-
from_array: ValueError: deepclone_from_array(): resolving a closure over a named callable requires enabling the allow_named_closures option
99+
from_array: ValueError: deepclone_from_array(): resolving a closure over a named callable requires enabling the "allow_named_closures" option; do it only if you trust the input; alternatively, install the "deepclone" extension, which can reference callables declared in constant expressions
100100
== 6. a hostile system() payload is refused by default ==
101-
system: ValueError: deepclone_from_array(): resolving a closure over a named callable requires enabling the allow_named_closures option
101+
system: ValueError: deepclone_from_array(): resolving a closure over a named callable requires enabling the "allow_named_closures" option; do it only if you trust the input; alternatively, install the "deepclone" extension, which can reference callables declared in constant expressions
102102
== 7. a named closure nested in an object graph is refused wholesale (before instantiation) ==
103-
nested: ValueError: deepclone_from_array(): resolving a closure over a named callable requires enabling the allow_named_closures option
103+
nested: ValueError: deepclone_from_array(): resolving a closure over a named callable requires enabling the "allow_named_closures" option; do it only if you trust the input; alternatively, install the "deepclone" extension, which can reference callables declared in constant expressions
104104
bool(true)
105105
bool(true)
106106
== 8. allowed_classes still gates Closure even with the opt-in ==

0 commit comments

Comments
 (0)