Private message welcome

3.2? - Private message welcome

Re: 3.2?

by wookiedachew » Sat Jul 07, 2018 2:46 pm

Sorry to revive this old post. I just installed with no problems, went to set up the message but then got this error message when I submitted it.
Anyone have any ideas how to fix this problem?

General Error
SQL ERROR [ mysqli ]

Incorrect string value: '\xF0\x9F\x9A\x80' for column 'config_value' at row 1 [1366]

SQL

UPDATE phpbb6a_config SET config_value = 'Hey welcome! 🚀' WHERE config_name = 'pmwelcome_subject'

BACKTRACE

FILE: (not given by php)
LINE: (not given by php)
CALL: msg_handler()

FILE: [ROOT]/phpbb/db/driver/driver.php
LINE: 996
CALL: trigger_error()

FILE: [ROOT]/phpbb/db/driver/mysqli.php
LINE: 193
CALL: phpbb\db\driver\driver->sql_error()

FILE: [ROOT]/phpbb/db/driver/factory.php
LINE: 329
CALL: phpbb\db\driver\mysqli->sql_query()

FILE: [ROOT]/phpbb/config/db.php
LINE: 148
CALL: phpbb\db\driver\factory->sql_query()

FILE: [ROOT]/phpbb/config/db.php
LINE: 122
CALL: phpbb\config\db->set_atomic()

FILE: [ROOT]/ext/apwa/pmwelcome/acp/pmwelcome_module.php
LINE: 113
CALL: phpbb\config\db->set()

FILE: [ROOT]/includes/functions_module.php
LINE: 676
CALL: apwa\pmwelcome\acp\pmwelcome_module->main()

FILE: [ROOT]/adm/index.php
LINE: 82
CALL: p_master->load_active()
wookiedachew
Registered User
Posts: 14
Joined: Sat Jun 23, 2018 7:06 pm
Contact:

Re: 3.2?

by Galixte de EzCom » Sun Jul 08, 2018 2:23 am

Please, put you code between BBCode CODE: help/bbcode

The 3.2.x version is here: https://github.com/Leinad4Mind/apwa/tre ... /pmwelcome.
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.1.x & 3.2.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.
Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.
User avatar
Galixte de EzCom
Registered User
Posts: 1041
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.
Contact:

Re: 3.2?

by 3Di » Sun Jul 08, 2018 2:36 am

Galixte de EzCom wrote: The 3.2.x version is here: https://github.com/Leinad4Mind/apwa/tre ... /pmwelcome.
Side note, that's a version not validated and it's not a version wrote by the present Author as well.
Moreover, that version does NOT fix the above error. ;)
wookiedachew wrote:Anyone have any ideas how to fix this problem?
Don't put Emojis there, that will fix it - so to speak. :)
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️
User avatar
3Di
Former Team Member
Posts: 14389
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: 3.2?

by Galixte de EzCom » Sun Jul 08, 2018 2:56 am

As you say, this author has completely abandoned his extensions, Leinad4Mind has fixed some bugs for 3.2.x version of phpBB.

Don't put Emojis there will not fix this issue it will avoid this problem.
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.1.x & 3.2.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.
Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.
User avatar
Galixte de EzCom
Registered User
Posts: 1041
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.
Contact:

Re: 3.2?

by 3Di » Sun Jul 08, 2018 3:22 am

Galixte de EzCom wrote:As you say, this author has completely abandoned his extensions, Leinad4Mind has fixed some bugs for 3.2.x version of phpBB.
I have not said that this author has abandoned the extension, I am saying instead that's not IMHO correct to abuse a validated extension support topic to spam other's not validated code, ask the new coder to open a topic in the Development forum... instead.
That's something I can't stand, I hope you will understand.

Galixte de EzCom wrote:Don't put Emojis there will not fix this issue it will avoid this problem.
As I said, this time..
3Di wrote:so to speak.
which means the same thing, avoid to put Emojis over there in order to "fix" your issue.

Programmatically it's quite easy to force the code to strip Emojis on data submission, it's not rocket science. :)
I do it on every extension of mine.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️
User avatar
3Di
Former Team Member
Posts: 14389
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: 3.2?

by Galixte de EzCom » Mon Jul 09, 2018 1:28 am

My bad, you didn’t say anything about “the present Author”. But as you can see he has completely abandoned his extensions.

I’m not a coder so don’t tell me « It’s not a rocket science » to take me down or whatever reason. If you take care about my activities like I consider you by spending times since a few years and you can see I’m only a FRENCH translator who spend some times to report bugs to the extensions/styles authors.

If “it's quite easy to force the code to strip Emojis on data submission” why don’t you share the way to be a more educating about your method to « force the code to strip Emojis on data submission” to the new developer Leinad4mind on his repository?
Last edited by Galixte de EzCom on Tue Jul 10, 2018 12:20 am
Communau EzCom
📖 « Traductions d’extensions & styles pour phpBB 3.1.x & 3.2.x ».
📋 Lists of all extensions identified for phpBB 3.1.x & 3.2.x.
📋 Lists of all styles identified for phpBB 3.1.x & 3.2.x.
Image Tu as un forum et tu veux aussi un site web ? Regarde par ici.
User avatar
Galixte de EzCom
Registered User
Posts: 1041
Joined: Mon Oct 04, 2004 11:14 pm
Location: France
Name: Raphaël M.
Contact:

Re: 3.2?

by 3Di » Mon Jul 09, 2018 6:27 pm

Galixte de EzCom wrote:why don’t you share the way
Function: https://github.com/phpBB-Studio/DateTop ... #L566-L574

Usage: https://github.com/phpBB-Studio/DateTop ... #L478-L480

I wasn't meant to take you down btw.
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️
User avatar
3Di
Former Team Member
Posts: 14389
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: 3.2?

by Leinad4Mind » Tue Jul 24, 2018 1:53 pm

I could apply the fix 3Di provided, basically it removes the emojis from the Subject. But that solution doesn't make sense in this extension tbh... (well, the only good thing would be that it would make it error free) Why it doesnt make sense? First, because the field is only wrote by admins. So the admin would know that he cant insert emojis. second, if the admin still wants to insert emojis, then the 3Di solution will destroy the ability to easely fix this by doing some manual changes on phpbb. Basically you guys must change the collation to utf8mb4.
Read more here: viewtopic.php?f=46&t=2340251#p14230956

This would solve this problem (its not an ext problem per se... its more a phpbb table limitation, that is not ready for emojis.):

Code: Select all

ALTER TABLE phpbb_config DROP PRIMARY KEY;
ALTER TABLE phpbb_config ADD PRIMARY KEY( config_name( 191 ) );
ALTER TABLE phpbb_config               CONVERT TO CHARACTER SET utf8mb4 COLLATE utf8mb4_unicode_ci;
And assuming you're using mysqli, I beleive you need to do only 1 change on 1 file, \phpbb\db\driver\mysqli.php
Find "SET NAMES 'utf8'" and change to "SET NAMES 'utf8mb4'"

This should be enough for fixing this. And afaik phpbb will change their collation to utf8mb4 on some future release (they should). More about that here: https://area51.phpbb.com/phpBB/viewtopic.php?t=44807 and here: https://area51.phpbb.com/phpBB/viewtopic.php?t=47706

Cheers
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 852
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: 3.2?

by 3Di » Wed Jul 25, 2018 12:24 am

That's not something doable, it could also seriously harm the DB, beware. :geek:

You may use this phpBB approach and tell the user they are trying to use illegal chars:
https://github.com/phpbb/phpbb/blob/049 ... 1150-L1156

Implemented in one of my extensions:
emojis_error_handling.png
Please PM me only to request paid works. Thx.
Want to compensate me for my interest? Donate
My development's activity º PhpStorm's proud user
Extensions, Scripts, MOD porting, Update/Upgrades
✒️ Black Friday 2019 @ The Studio ▪️◾️
User avatar
3Di
Former Team Member
Posts: 14389
Joined: Mon Apr 04, 2005 11:09 pm
Location: Milan (IT) Frankfurt (DE)
Name: Marco
Contact:

Re: 3.2?

by Leinad4Mind » Wed Jul 25, 2018 2:28 pm

About doing harm to the DB, well maybe just on future updates xD
But it seems a good solution for those who wants to solve the problem right now. (I mean, those who wants to use emojis.)

I dont know what phpbb will apply on the future, but after some real thought on this matter, your idea seems to be the best approach for this extension at least. Because it will prevent the bug from happening (users will not be able to use emojis on this extension though, and this is what all seems to want). And then we could have another extension for emojis that will work on this extension as well (because phpbb doesnt support true emojis on database since collation is not utf8mb4, but the extensions converts to a code representation that can be saved at utf8). I know there are some emojis solutions already but I beleive they only work on posts, so we should adapt to work on config table so we could use emojis on this ext as well.

So yeah, now all admins have here all the info they need. They can go for the solution they prefer. I'll probably follow 3Di idea, since it seems the best way to have it working without bugs + not compromising future releases. So say goodbye to emojis, till phpbb decide to implement a oficial solution.

Best regards

PS: Thks for the comments 3Di
Want to access all my portuguese MOD and Extension translations?
Become my Patreon!
phpBB Portugal Translator and Moderator
User avatar
Leinad4Mind
Translator
Posts: 852
Joined: Sun Jun 01, 2008 11:08 pm
Contact:

Re: 3.2?

by wads24 » Fri Jan 11, 2019 2:32 am

Thanks in advance for a reply.
User avatar
wads24
Registered User
Posts: 528
Joined: Fri Jun 10, 2005 4:44 am
Name: James