CodeIgniter4: Bug: [Toolbar] Segmentation fault if View data has an Time objects

PHP Version

8.2

CodeIgniter4 Version

4.3.7

CodeIgniter4 Installation Method

Composer (using codeigniter4/appstarter)

Which operating systems have you tested for this bug?

Linux

Which server did you use?

cli-server (PHP built-in webserver)

Database

No response

What happened?

Toolbar filter breaks if View Render $data contains objects. I suppose it is intended to output an array of values that are contained in the view('home', ['title' => 'Home']). I have passed objects (+ nested ones) to the render. The debugger breaks down, wanting to get a simple array. See screenshot debugger

https://github.com/codeigniter4/CodeIgniter4/blob/892f4041b358c9a93be863b798caa34158b450cc/system/Debug/Toolbar.php#L317 this code break down, run

    public function getVarData(): array
    {
        $this->initViewer();

        return [
            'View Data' => $this->viewer->getData(), // many objects

        ];
    }

Steps to Reproduce

  1. Pass some complex object (Entity) to the template, including date and time, nested objects.
  2. Enable the Toolbar filter
  3. Open page, see crash

Expected Output

Normal job of the toolbar is expected

Anything else?

It might be worth talking to the developers of kint-php. Dump ($this->collector’s) in vendor/codeigniter4/framework/system/Debug/Toolbar.php cannot fully display the output - raising the limit on recursion to 7 does not work (crash)

About this issue

  • Original URL
  • State: closed
  • Created a year ago
  • Comments: 16 (16 by maintainers)

Most upvoted comments

I install PHP 8.2.8. Solved