-
-
Notifications
You must be signed in to change notification settings - Fork 445
Change initStatements to charset option when create db connection. #4173
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
base: main
Are you sure you want to change the base?
Conversation
- This options pass to default Zend_Db_Adapter_Pdo_Abstract when init PDO
Have you put this in production? What are the effects/benefits with or without this PR? |
Yes, I have used it in production without breaking anythings. I found this because I was thinking that So, this commit did not breaking anythings and did not solve my original problem either. But 1 lesser query on every connections might be a beneficial for overall. |
Ref https://dev.mysql.com/doc/refman/8.4/en/charset-connection.html
I also read the referenced stackoverflow. I am not sure how it related to our use case. UTF8 has been default in OpenMage since the beginning and we don't have any issues mentioned in the stackoverflow such as threat and wrong encoding in client. I propose to close this PR unless there is a more compelling reason. |
Sorry that I give bad reference. It start when Openmage create new PDO in Zend_Db_Adapter_Pdo_Abstract
$dsn = "$mysql:model=mysql4;initStatements=SET NAMES utf8;type=pdo_mysql;host=mysql;dbname=openmage;active=1";
$dsn = "$mysql:model=mysql4;charset=utf8;type=pdo_mysql;host=mysql;dbname=openmage;active=1";
So when no
|
Seems OK to me with my tests. |
I'm leaning towards merging this for a few reasons:
I haven't tested this yet, but will approve once confirmed unless there are other objections. |
|
SET NAMES utf8
might be there as a workaround for php < 5.3.6 but should not be a case anymore.*When Openmage start. It seems to merge every
etc/*.xml
config including this file. So before this commit, end-user who want to removeinitStatements
must explicitly set empty to<initStatements />
in later file. Otherwise it still be there.Contribution checklist (*)