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

[VarExporter] Improve error message for Lazy Ghosts failing reinitializing classes due to readonly properties #57067

Closed
wants to merge 4 commits into from

Conversation

curry684
Copy link
Contributor

@curry684 curry684 commented May 22, 2024

Q A
Branch? 7.1
Bug fix? sort of
New feature? no
Deprecations? no
Issues #54228
License MIT

As discussed in #54228, Lazy Ghosts cannot reinitialize classes with readonly properties due to PHP limitations. Currently, this will often lead to a vague crash minutes or even hours later stating only:

Cannot modify readonly property Doctrine\ORM\EntityManager::$conn

This PR improves the error message to:

Lazy ghost cannot reinitialize readonly property "Doctrine\ORM\EntityManager::$conn", remove the readonly modifier on that property and/or its containing class, or ensure the ghost will never be reinitialized

@carsonbot carsonbot added Status: Needs Review DX DX = Developer eXperience (anything that improves the experience of using Symfony) VarExporter labels May 22, 2024
@carsonbot
Copy link

Hey!

Thanks for your PR. You are targeting branch "7.2" but it seems your PR description refers to branch "7.1".
Could you update the PR description or change target branch? This helps core maintainers a lot.

Cheers!

Carsonbot

@carsonbot carsonbot added this to the 7.2 milestone May 22, 2024
@carsonbot carsonbot changed the title [DX] [VarExporter] Improve error message for Lazy Ghosts failing reinitializing classes due to readonly properties [VarExporter] Improve error message for Lazy Ghosts failing reinitializing classes due to readonly properties May 22, 2024
@curry684 curry684 changed the base branch from 7.2 to 7.1 May 22, 2024 21:44
I really shouldn't code in the web IDE
Copy link
Member

@nicolas-grekas nicolas-grekas left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Testeable ?

Co-authored-by: Nicolas Grekas <nicolas.grekas@gmail.com>
@curry684
Copy link
Contributor Author

Testeable ?

Would boil down to a convoluted test case just for a stringwise comparison on the error message. Not worth it imo since it can't break anything.

@derrabus
Copy link
Member

Testeable ?

Would boil down to a convoluted test case just for a stringwise comparison on the error message. Not worth it imo since it can't break anything.

Definitely worth it because we're parsing an error message emitted by the PHP runtime and the PHP folks are infamous for applying subtle changes to their error messages in minor releases.

@curry684
Copy link
Contributor Author

the PHP folks are infamous for applying subtle changes to their error messages in minor releases

But why... 🤦 I'll see if I can whip something up.

@curry684
Copy link
Contributor Author

curry684 commented Jun 6, 2024

Couldn't quickly build a reliable unit test in a reasonable time, far too busy to really try for just an error message.

@curry684 curry684 closed this Jun 6, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
DX DX = Developer eXperience (anything that improves the experience of using Symfony) Status: Needs Review VarExporter
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants