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

PDO: improve PDO::ATTR_STRINGIFY_FETCHES description #4359

Merged
merged 1 commit into from
Jan 5, 2025

Conversation

pereorga
Copy link
Contributor

@pereorga pereorga commented Jan 5, 2025

  1. Standardizes definition in both constants and setattribute pages. I'm not sure this duplication is ideal, but that is how the PDO documentation is currently structured.
  2. Update text to reflect that it's not the numeric values that get converted, it's all non-null values. (E.g. boolean values get converted too.). I imagine the behavior could theoretically be different depending on the PDO driver, and that the behavior may have been different in the past too, but that seems to be the case nowadays in all core drivers, and so I think it's useful to state it.
  3. Specify the default. Again, this may be driver-specific (an extension may override it), but at least that seems to be the case in all existing supported drivers.
  4. Mention ATTR_ORACLE_NULLS. As a developer, it can be useful to enforce all types to be string, and that could be wrongly assumed to be done by this constant (named ATTR_STRINGIFY_FETCHES).

@pereorga
Copy link
Contributor Author

pereorga commented Jan 5, 2025

I noticed that https://www.php.net/manual/en/pdo.constants.php lists all boolean constants as int. I guess there may be an historical reason for this, happy to update it in another PR if it makes sense.

@kamil-tekiela
Copy link
Member

I noticed that https://www.php.net/manual/en/pdo.constants.php lists all boolean constants as int. I guess there may be an historical reason for this, happy to update it in another PR if it makes sense.

Which one of them is not null?

@kamil-tekiela
Copy link
Member

E.g. boolean values get converted too.

That is only true as of PHP 8.1. I don't know if it's worth mentioning in the documentation though since only PGSQL has boolean type.

Copy link
Member

@kamil-tekiela kamil-tekiela left a comment

Choose a reason for hiding this comment

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

LGTM!

@kamil-tekiela kamil-tekiela merged commit 9d792d3 into php:master Jan 5, 2025
2 checks passed
@pereorga
Copy link
Contributor Author

pereorga commented Jan 6, 2025

I noticed that https://www.php.net/manual/en/pdo.constants.php lists all boolean constants as int. I guess there may be an historical reason for this, happy to update it in another PR if it makes sense.

Which one of them is not null?

Never mind, I got confused with the type of the constants

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants