-
-
Notifications
You must be signed in to change notification settings - Fork 17
char(1) is padded with spaces with charset UTF8 #25
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
Labels
bug
Something isn't working
Comments
Yes, that's right. We should fix it. |
Is a solution already in sight? |
pdo-firebird fixed with this: php/php-src#8576 |
tested on php: 5.5, 5.5, 7.1, 7.3 |
Wouldn't that turn all CHAR types to VARCHAR? |
MartinKoeditz
pushed a commit
that referenced
this issue
Apr 24, 2025
Well, basically yes. But it's only an internal conversion. I couldn't find any problems. I also created a test for that issue. Please check it out. |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
With a FB connection using charset UTF-8:
select cast('A' as char(1)) from rdb$database;
The result using ibase_fetch_object will be 'A ' ("A" padded with 3 spaces).
select cast('A' as varchar(1)) from rdb$database;
The result will be 'A', which is correct.
It seems that FB transfers the char(1) padded with spaces to fill the 4 bytes buffer, but for the end user, a char(1) should never return more than 1 character. IMHO, in such cases, the PHP driver should strip out any extra spaces before delivering the result to the final user in a way that the result would never has more characters than the declared field size.
The text was updated successfully, but these errors were encountered: