Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bug: Long time to debug (with dd) for enum #6429

Closed
MrFrost-Nv27 opened this issue Aug 26, 2022 · 6 comments · Fixed by #6436
Closed

Bug: Long time to debug (with dd) for enum #6429

MrFrost-Nv27 opened this issue Aug 26, 2022 · 6 comments · Fixed by #6436
Labels
bug Verified issues on the current code behavior or pull requests that will fix them

Comments

@MrFrost-Nv27
Copy link

MrFrost-Nv27 commented Aug 26, 2022

PHP Version

8.1

CodeIgniter4 Version

4.2.4

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Windows

Which server did you use?

apache

Database

MySQL

What happened?

If we debugging with dd for enum, especially enum cases or enum class itself, its taking long time . but if we debug enum's name or value is not long.

Steps to Reproduce

We create an enum
Screenshot (26)

namespace MrFrost\HtmlObject\Enums\Attributes;

enum GlobalAttributes: string
{
    case accesskey = "Specifies a shortcut key to activate/focus an element";
    case contenteditable = "Specifies whether the content of an element is editable or not";
    case data = "Used to store custom data private to the page or application";
    case dir = "Specifies the text direction for the content in an element";
    case draggable = "Specifies whether an element is draggable or not";
    case hidden = "Specifies that an element is not yet, or is no longer, relevant";
    case id = "Specifies a unique id for an element";
    case lang = "Specifies the language of the element's content";
    case spellcheck = "Specifies whether the element is to have its spelling and grammar checked or not";
    case style = "Specifies an inline CSS style for an element";
    case tabindex = "Specifies the tabbing order of an element";
    case title = "Specifies extra information about an element";
    case translate = "Specifies whether the content of an element should be translated or not";

    public function getType(): bool
    {
        return match ($this) {
            self::contenteditable, self::draggable, self::hidden, self::spellcheck, self::translate => "bool",
            default => "string"
        };
    }
}

And debug the enum cases
Screenshot (27)
dd(GlobalAttributes::cases());
is taking long time then we get "Maximum execution time" error
Screenshot (25)

Expected Output

Fatal error: Maximum execution time of 120 seconds exceeded in E:\Nova\Latihan\HtmlObject\vendor\kint-php\kint\src\Renderer\RichRenderer.php on line 518

Anything else?

No response

@MrFrost-Nv27 MrFrost-Nv27 added the bug Verified issues on the current code behavior or pull requests that will fix them label Aug 26, 2022
@kenjis
Copy link
Member

kenjis commented Aug 27, 2022

Can you give the minimum code (not a screenshot) to reproduce the issue?

@MrFrost-Nv27
Copy link
Author

MrFrost-Nv27 commented Aug 27, 2022

Can you give the minimum code (not a screenshot) to reproduce the issue?

That i update the thread and add my code, that i use enum from my package by composer, you can try create the enum in libraries folder to try it and change the namespace, then the bug is if we debug with dd the enum class, or enum->cases() method its taking long time, sometimes its getting error because the time load is long, maybe its because enum is'n have access scope so the kint library try to looping it much time, but i did'nt really know

@kenjis
Copy link
Member

kenjis commented Aug 27, 2022

@MrFrost-Nv27 Thank you for update!
I've confirmed the behavior.

It seems an issue in Kint. I created an Issue: kint-php/kint#392

@MrFrost-Nv27
Copy link
Author

@MrFrost-Nv27 Thank you for update! I've confirmed the behavior.

It seems an issue in Kint. I created an Issue: kint-php/kint#392

Ok thanks for the response

@MrFrost-Nv27
Copy link
Author

Oke great, thanks

@kenjis
Copy link
Member

kenjis commented Aug 28, 2022

Kint 4.2.0 was released.

If you install CodeIgniter via Composer, composer update will solve this problem.
If not, the next release CodeIgniter v4.2.5 would solve this problem.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Verified issues on the current code behavior or pull requests that will fix them
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants