FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » FUDforum » FUDforum Installation Issues » Errore nntp: PHP Fatal error: SQL error has occurred!
Show: Today's Messages :: Polls :: Message Navigator
Switch to threaded view of this topic Create a new topic Submit Reply
Errore nntp: PHP Fatal error: SQL error has occurred! [message #187440] Wed, 04 April 2018 17:29 Go to next message
enzo.cons is currently offline  enzo.cons
Messages: 9
Registered: April 2018
Karma: 0
Junior Member
After some nntp importing, on latest FUDforum, versione i have this strange error message

Importing #383410 from xx.xxxxx.xxxxxxxPHP Fatal error: SQL error has occurred! Please contact the <a href="mailto:xxxxxx(at)gmail(dot)com?subject=SQL%20Error">administrator</a> and have them look at the Error Log Viewer in the forum's Admin Control Panel. in /mnt/data/www/fud-data/include/core.inc on line 250

And that is the only entry on admin panel log

Wed Apr 4 17:14:59 GMT 2018 (/mnt/data/www/fud-data/include/theme/default/db.inc:112
/mnt/data/www/fud-data/include/theme/default/db.inc:217
/mnt/data/www/fud-data/include/theme/default/imsg_edt.inc:116
/mnt/data/www/fud-data/scripts/nntp.php:296
) 1366: Incorrect string value: '\xE8 mort...' for column 'subject' at row 1
Query:
Database version: 5.7.21-0ubuntu0.16.04.1

Any suggestions?
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187441 is a reply to message #187440] Wed, 04 April 2018 18:15 Go to previous messageGo to next message
naudefj is currently offline  naudefj   United States
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
What do you mean by latest FUDforum version? Please be exact.
What is the subject of the message that you are importing?
Does it only contain UTF8 characters?
Can you database handle these characters?
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187442 is a reply to message #187441] Wed, 04 April 2018 20:57 Go to previous messageGo to next message
enzo.cons is currently offline  enzo.cons
Messages: 9
Registered: April 2018
Karma: 0
Junior Member
naudefj ha scritto in data Wed, 04 April 2018 18:15
What do you mean by latest FUDforum version? Please be exact.
FUDforum: 3.0.8
PHP: 7.0.28-0ubuntu0.16.04.1
Database: mysql 5.7.21-0ubuntu0.16.04.1 (mysqli)
Operating system: Linux 4.4.0-116-generic

Quota:
What is the subject of the message that you are importing?
i think something like "é morto..."

Quota:
Does it only contain UTF8 characters?
Yes

Quota:
Can you database handle these characters?
Im using utf8mb4 on DB and according my phpmyadmin objet like subjectIndice in table fud30_msg is "varchar(255) utf8_unicode_ci"
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187443 is a reply to message #187442] Thu, 05 April 2018 14:46 Go to previous messageGo to next message
enzo.cons is currently offline  enzo.cons
Messages: 9
Registered: April 2018
Karma: 0
Junior Member
Is there any other log file can i check?
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187445 is a reply to message #187443] Fri, 06 April 2018 19:49 Go to previous messageGo to next message
naudefj is currently offline  naudefj   United States
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
I've constructed a test message with that subject and was able to import it without a problem.

Would you be able to share the original message with me for testing?

Regards.
Frank
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187446 is a reply to message #187445] Sat, 07 April 2018 12:41 Go to previous messageGo to next message
enzo.cons is currently offline  enzo.cons   Italy
Messages: 9
Registered: April 2018
Karma: 0
Junior Member
Sorry, im unable to hunderstand what message is. The ng is "it.comp.console" and nntp.php indicate it as #383410

But i think that's some related my php or my mysql, but not understand what could be.
On mysql im sure the db is utf8 compliant.... But don't know what need to check on php side.
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187447 is a reply to message #187446] Sun, 08 April 2018 10:57 Go to previous messageGo to next message
enzo.cons is currently offline  enzo.cons   Italy
Messages: 9
Registered: April 2018
Karma: 0
Junior Member
move to pgsql
Have a little more verbosity message on console

Importing #383408 from it.comp.console
Importing #383409 from it.comp.console
Importing #383410 from it.comp.consolePHP Warning: pg_query(): Query failed: ERROR: invalid byte sequence for encoding "UTF8": 0xe8 0x20 0x6d in /mnt/data/www/fud-data/include/theme/default/db.inc on line 108
PHP Fatal error: SQL error has occurred! Please contact the <a href="mailto:enzo(dot)cons(at)gmail(dot)com?subject=SQL%20Error">administrator</a> and have them look at the Error Log Viewer in the forum's Admin Control Panel. in /mnt/data/www/fud-data/include/core.inc on line 250

And on log page:
Sun Apr 8 10:49:09 GMT 2018 (/mnt/data/www/fud-data/include/theme/default/db.inc:108
/mnt/data/www/fud-data/include/theme/default/db.inc:198
/mnt/data/www/fud-data/include/theme/default/imsg_edt.inc:116
/mnt/data/www/fud-data/scripts/nntp.php:296
) : ERROR: invalid byte sequence for encoding "UTF8": 0xe8 0x20 0x6d
Query:
Database version: 9.5.12


Im thinking is a db schema, is possible to edit initial setup script to create a full DB in utf8m4?
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187448 is a reply to message #187447] Sun, 08 April 2018 11:17 Go to previous messageGo to next message
enzo.cons is currently offline  enzo.cons   Italy
Messages: 9
Registered: April 2018
Karma: 0
Junior Member
Have found some advice to handle utf8mb4 on my SQL here

https://mathiasbynens.be/notes/mysql-utf8mb4

Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187449 is a reply to message #187448] Sun, 08 April 2018 12:47 Go to previous messageGo to next message
naudefj is currently offline  naudefj   United States
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
I think we can fix it by UTF encoding the subject (and maybe other parts of the message as well).
I'll prepare a patch, otherwise you can try to add something like this to nntp.php:
$emsg->subject = utf8_encode($emsg->subject);
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187450 is a reply to message #187449] Sun, 08 April 2018 12:55 Go to previous messageGo to next message
enzo.cons is currently offline  enzo.cons   Italy
Messages: 9
Registered: April 2018
Karma: 0
Junior Member
Very Happy

Sure i will check now!

Edit:
It works!

Change

fud_wordwrap($msg_post->body);
$msg_post->subject = apply_custom_replace($emsg->subject);
if (!strlen($msg_post->subject)) {


in

fud_wordwrap($msg_post->body);
$emsg->subject = utf8_encode($emsg->subject); //custom fix from naudefj
$msg_post->subject = apply_custom_replace($emsg->subject);
if (!strlen($msg_post->subject)) {

[Updated on: Sun, 08 April 2018 13:02]

Report message to a moderator

Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187451 is a reply to message #187450] Sun, 08 April 2018 18:17 Go to previous messageGo to next message
naudefj is currently offline  naudefj   United States
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Thanks for confirming.

Regards.
Frank
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187453 is a reply to message #187451] Mon, 09 April 2018 13:28 Go to previous messageGo to next message
enzo.cons is currently offline  enzo.cons
Messages: 9
Registered: April 2018
Karma: 0
Junior Member
Thank u for the support.
Do u you will all check\patch all the others fields like msg, username, ecc ecc to prevent other issue like that?
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187454 is a reply to message #187453] Mon, 09 April 2018 17:39 Go to previous messageGo to next message
naudefj is currently offline  naudefj   United States
Messages: 3771
Registered: December 2004
Karma: 28
Senior Member
Administrator
Core Developer
Not sure I understand, but if you encounter other problems, please let me now so we can patch the code base.

Regards.
Frank
Re: Errore nntp: PHP Fatal error: SQL error has occurred! [message #187456 is a reply to message #187454] Wed, 11 April 2018 07:51 Go to previous message
enzo.cons is currently offline  enzo.cons
Messages: 9
Registered: April 2018
Karma: 0
Junior Member
Now looks like all fine. Don't know only if the same bug affect also body or username.
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: install.php(step 3 of 5) show pg_query warning messages
Next Topic: Fatal Error when backing up
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Sat Nov 30 03:55:01 GMT 2024

Total time taken to generate the page: 0.03573 seconds