Skip to content

Commit d98e392

Browse files
Trim verbose comment on probe rule
1 parent 28dbe8b commit d98e392

1 file changed

Lines changed: 3 additions & 10 deletions

File tree

deepclone.c

Lines changed: 3 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -394,16 +394,9 @@ static uint8_t dc_get_class_info(dc_ctx *ctx, zend_class_entry *ce)
394394
flags |= DC_CI_NOT_INSTANTIABLE;
395395
}
396396

397-
/* Internal classes with C-level state (create_object != NULL):
398-
* Rule A: final + no serialization API → probe instantiation; reject if it fails.
399-
* Rule B: non-final + no serialization API → reject.
400-
* Classes declaring __serialize/__unserialize/__sleep/__wakeup are trusted:
401-
* they round-trip via object_init_ex() + __unserialize(), same as PHP's
402-
* own serialize/unserialize.
403-
* Rule A uses a probe instead of an unconditional reject because some final
404-
* internal classes are stateless and fully reconstructable from their PHP-
405-
* visible properties (e.g. MongoDB\BSON\MinKey / MaxKey): object_init_ex()
406-
* succeeds and produces a complete object with no hidden C-level state. */
397+
/* Internal classes with create_object and no serialization API:
398+
* final → probe instantiation (stateless classes like BSON\MinKey pass);
399+
* non-final → reject. Classes with __serialize/__unserialize are trusted. */
407400
if (ce->type == ZEND_INTERNAL_CLASS
408401
&& ce->create_object != NULL
409402
&& (ce->ce_flags & ZEND_ACC_FINAL)

0 commit comments

Comments
 (0)