Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Fix exceptions (PDOException) error code type#33713

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 ourterms of service andprivacy statement. We’ll occasionally send you account related emails.

Already on GitHub?Sign in to your account

Merged
fabpot merged 1 commit intosymfony:4.3fromed-fruty:fix-pdo-exceptions
Sep 26, 2019

Conversation

@ed-fruty
Copy link

QA
Branch?4.3
Bug fix?yes
New feature?no
Deprecations?no
TicketsFix#33704
LicenseMIT

From thephp.net docsException::getCode() description:

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

So if can be string, we convert it to the int in theHandlerFailedException but it still string innestedExceptiions.

Copy link
Member

@fabpotfabpot left a comment

Choose a reason for hiding this comment

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

If the code can be a string, maybe we can change the type hint and allow a string everywhere? Casting to a string means that strings will always be converted to 0, right? Not sure if this is a problem though.

@ed-fruty
Copy link
Author

We can't allowstring type.

php -aphp>$e = new Exception('message','string');PHP Warning:  Uncaught Error: Wrong parametersforException([string $message [, long $code [, Throwable $previous = NULL]]])in php shell code:1Stack trace:#0 php shell code(1): Exception->__construct('message', 'string')#1 {main}  thrownin php shell code on line 1

PHP does not allow it.

@fabpot
Copy link
Member

Thank you@ed-fruty.

fabpot added a commit that referenced this pull requestSep 26, 2019
This PR was squashed before being merged into the 4.3 branch (closes#33713).Discussion----------Fix exceptions (PDOException) error code type| Q             | A| ------------- | ---| Branch?       | 4.3| Bug fix?      | yes| New feature?  | no| Deprecations? | no| Tickets       |Fix#33704| License       | MITFrom the [php.net docs](https://www.php.net/manual/en/exception.getcode.php) `Exception::getCode()` description:> Returns the exception code as integer in Exception but possibly as other type in Exception descendants (for example as **string** in PDOException).So if can be string, we convert it to the int in the `HandlerFailedException` but it still string in `nestedExceptiions`.Commits-------9efa025 Fix exceptions (PDOException) error code type
@fabpotfabpot merged commit9efa025 intosymfony:4.3Sep 26, 2019
@fabpotfabpot mentioned this pull requestOct 7, 2019
Sign up for freeto join this conversation on GitHub. Already have an account?Sign in to comment

Reviewers

@fabpotfabpotfabpot approved these changes

Assignees

No one assigned

Projects

None yet

Milestone

No milestone

Development

Successfully merging this pull request may close these issues.

3 participants

@ed-fruty@fabpot@carsonbot

[8]ページ先頭

©2009-2025 Movatter.jp