Thanks to visit codestin.com
Credit goes to github.com

Skip to content

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
Contributor

@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.

4 participants