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

Remove int return type from FlattenException::getCode #35993

Merged
merged 1 commit into from Mar 9, 2020

Conversation

wucdbm
Copy link
Contributor

@wucdbm wucdbm commented Mar 7, 2020

Q A
Branch? 4.4
Bug fix? yes
New feature? no
Deprecations? no
Tickets -
License MIT
Doc PR -

Heya,

So my project died with Return value of Symfony\Component\ErrorHandler\Exception\FlattenException::getCode() must be of the type int, string returned symfony error page. Quite unexpected.

Turns out it's a Doctrine\DBAL\Driver\PDOException with code 42S02 and message SQLSTATE[42S02]: Base table or view not found: 1146 Table 'some_db.some_table' doesn't exist.

This is because I use the FlattenException class to serialize errors and store elsewhere, just more convenient to quickly check for any errors. I guess noone has stumbled upon a PDOException / FlattenException::getCode before.

https://www.php.net/manual/en/throwable.getcode.php

Returns the exception code as integer in Exception but possibly as other type in Exception descendants (for example as string in PDOException).

Copy link
Member

@Tobion Tobion left a comment

Choose a reason for hiding this comment

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

please add a unit test testing setCode and getCode can accept string.

@fabpot
Copy link
Member

fabpot commented Mar 9, 2020

Thank you @wucdbm.

@fabpot fabpot merged commit d8d7357 into symfony:4.4 Mar 9, 2020
This was referenced Mar 27, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants