Skip to content

Internal enums can be cloned and compared #20914

Closed

Description

@arnaud-lb

Description

The following code:

<?php

var_dump(clone(ZendTestIntEnum::Foo) === ZendTestIntEnum::Foo);

Resulted in this output:

bool(false)

But I expected this output instead:

Uncaught Error: Trying to clone an uncloneable object of class ZendTestIntEnum

This is because we don't override the default object handlers in zend_register_internal_enum().

PHP Version

PHP 8.3

Operating System

No response

Activity

  1. self-assigned this
    on Jan 12, 2026
  2. changed the title [-]Internal enums can be cloned[/-] [+]Internal enums can be cloned and compared[/+] on Jan 12, 2026
  3. added a commit that references this issue on Jan 13, 2026
    075b6b8
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions