-
Notifications
You must be signed in to change notification settings - Fork 195
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
Zend db returning everything as string #362
Comments
Why is that problem? You are using PHP, not C++. |
Anyway, it's bad idea even to touch it, as this is breaking change bringing no value. |
this is actually recently changed behavior I think its best to revert this commit |
@Jimbolino if I remember correctly, PDO fetch was always returning strings. Why is this problem anyway? Are we C++ now? |
..or at least was, not sure now. As I'm pretty ignoring types, unless are classes. |
YEp, just checked the docs. Before 8.1 all were strings. So now the question is, if we are going to keep framework consistent or we are going to adjust framework to some enforced typing. Maybe there is a way in the middle: what about to introduce method to disable stringify? Then we have backwards compatibility and also have possibility to go forward with strict types within framework. |
afaik since php uses mysqlnd (optional since php 5.3, default in php 5.4) the pdo-mysql driver returns datatypes as they are configured in the database. I read the migration notes: https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo
In general i'm not a big fan of overwriting defaults to stay compatible with older versions. When a developer upgrades their php version, it is their responsibility to check if their code is compatible with the new version (usually by reading a changelog). By putting these defaults in zf1 we become responsible for these backwards incompatible changes. Usually users dont read changelogs when they do a @hungtrinh please tell us how you see things :) |
@Jimbolino I understand your frustration. From my point of view, to save time upgrading libraries for many ZF1 based projects, I want to keep everything backward compatible as much as possible To solve your problem i think you can make an PR:
So in your use case in zf project folder ... \\after Zend Framework Autoload library line
Zend_Db_Adapter_Pdo_Abstract::$isPdoStringifyFetchesBackwardCompatiblePhp8) = false; Why use static attribute why not use normal property support setting per connection?Because Project base on ZF1 we have 2 use case only
Use static property flag save time to setting for project in 1 line at 1 startup point. |
BC with php <= 8.0 alway fetch digit field type as string digit https://www.php.net/manual/en/migration81.incompatible.php#migration81.incompatible.pdo.mysql
data fetch from database, every column is returned as string instead of proper data type, even int is returned as string like "1"
The text was updated successfully, but these errors were encountered: