php / php/php-src

Error when killing script: Object of class UnwindExit could not be converted to string

Open
#11,821 3 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

Bug Category: Engine Status: Verified
Dominant language
C
Stars
40.4k
Forks
8.1k
Avg merge
2d 13h
Merged PRs (30d)
96

Description

Description

I am running PHP 8.2.8 and PHP 8.3.0 Beta 1, and at times, I get this error when killing a cli script:

Object of class UnwindExit could not be converted to string

It's been tricky to reproduce, but I can intermittently get the error by:

  1. Unzip attached code.zip.
  2. Run: php -n test.php
  3. Immediately press Ctrl-C.

If no errors appear, repeat running the script and pressing Ctrl-C.

The error I get is:

Warning: Uncaught Error: Object of class UnwindExit could not be converted to string in /tmp/test/a.php:2
Stack trace:
#0 /tmp/test/test.php(4): require()
#1 /tmp/test/test.php(14): {closure}('a')
#2 {main}
  thrown in /tmp/test/a.php on line 2

Fatal error: During class fetch: Uncaught  in /tmp/test/a.php on line 2

I believe the error comes up when the script is killed while one of the classes is being loaded.

Please let me know if I can provide more information to narrow it down.

Thanks for your help.

PHP Version

PHP 8.2.8 and PHP 8.3.0 Beta 1

Operating System

Linux

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Unpack code.zip and start with /tmp/test/test.php and /tmp/test/a.php; run php -n test.php and press Ctrl-C while the script is loading classes. Trace the CLI interruption and class-loading path around this reproduction. Done means the intermittent UnwindExit conversion error no longer occurs when the script is killed.

Written by the indexing model from the issue text.

Assessment

Tech stack
c, php
Domain
backend, cli
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Quiet
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.