Repository navigation
Conversation
Reject unsupported ATTR_ORACLE_NULLS values before narrowing them into the two-bit field, preserving the previous mode when validation fails. The constructor and setAttribute() share this validation.
Member
|
I was experimenting with using From b4d1316e21f55e02d4b9e2be557754295428f5e2 Mon Sep 17 00:00:00 2001
From: Calvin Buckley <calvinb@php.net>
Date: Mon, 19 Oct 2026 17:39:49 -0300
Subject: [PATCH 06/10] ext/pdo: convert pdo_null_handling to C23 enum
---
ext/pdo/php_pdo_driver.h | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
diff --git a/ext/pdo/php_pdo_driver.h b/ext/pdo/php_pdo_driver.h
index cce888d5b35..1eb5a8794cc 100644
--- a/ext/pdo/php_pdo_driver.h
+++ b/ext/pdo/php_pdo_driver.h
@@ -168,7 +168,7 @@ C23_ENUM(pdo_case_conversion, uint8_t) {
};
/* oracle interop settings */
-enum pdo_null_handling {
+C23_ENUM(pdo_null_handling, uint8_t) {
PDO_NULL_NATURAL = 0,
PDO_NULL_EMPTY_STRING = 1,
PDO_NULL_TO_STRING = 2
@@ -464,8 +464,8 @@ struct _pdo_dbh_t {
/* The PDO Error mode */
pdo_error_mode error_mode;
- /* oracle compat; see enum pdo_null_handling */
- uint8_t oracle_nulls;
+ /* Empty/null string conversion */
+ pdo_null_handling oracle_nulls;
/* Case conversion */
pdo_case_conversion native_case;
--
2.54.0 |
NattyNarwhal
approved these changes
Oct 20, 2026
NattyNarwhal
left a comment
Member
There was a problem hiding this comment.
Looks fine as-is anyways.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
PDO accepted unsupported values for
PDO::ATTR_ORACLE_NULLSand truncated them into its two-bit storage, so 4 silently selected PDO::NULL_NATURAL. Invalid modes now raise ValueError before changing the attribute, including when supplied through constructor options.