I get an error "PDOException dblog_watchdog() line 155" when i try to add a node which it's title consists of a spesific combination of Greek letters. I Currently have Pathauto to deal with the aliases. The default language is set to Greek.

Tracking down line 155 in dblog_watchdog i decided to delete the following line:
'link' => substr($log_entry['link'], 0, 255) and the PDOException dissapeared

Also using 'link' => mb_substr($log_entry['link'], 0, 255) instead of substr($log_entry['link'], 0, 255)
seems to also do the trick

Also switching the default language from Greek to English also seemed to make the error go away

One of the spesific urls that throw the PDOexception is: φορείς-δικτύου/σοροπτιμιστική-ένωση-ελλάδος

I don't get much more information besides it being a PDOException at line 155

Comments

detectivepixel’s picture

Category: support » bug

Changing the default translation string for the word "view" that Localization update downloaded seems to work.

Steps to reproduce the exception on an (almost) bare bones Drupal 7.18 installation

- Enable Locale
- Add Language Greek
- Download and enable Localization update and update the translations (haven't tried to import manually)
- Add a node with URL alias "φορείς-δικτύου/σοροπτιμιστική-ένωση-ελλάδος"
-Translate the word view as "προβολή" (this might not be necessary since localization update translates the word like that)

orb’s picture

Version: 7.18 » 7.21
Status: Active » Needs review
StatusFileSize
new647 bytes

Change substr($log_entry['link'], 0, 255),
to
drupal_substr($log_entry['link'], 0, 255),

Status: Needs review » Needs work

The last submitted patch, dblog-non_latin_characters_in_url-1888592-2.patch, failed testing.

orb’s picture

Fix

orb’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, dblog-non_latin_characters_in_url-1888592-4.patch, failed testing.

podarok’s picture

Status: Needs work » Needs review

Status: Needs review » Needs work

The last submitted patch, dblog-non_latin_characters_in_url-1888592-4.patch, failed testing.

dzhu’s picture

StatusFileSize
new1.2 KB

The same issue for saving nodes that have long synonyms in Russian.

My proposal: increase link field in watchdog table from 255 to 1024. Here is part of the patch:

diff -rupN /home_old/modules/dblog/dblog.install /home_new/modules/dblog/dblog.install
--- /home_old/modules/dblog/dblog.install	2013-03-26 16:04:28.000000000 +0400
+++ /home_new/modules/dblog/dblog.install	2013-03-26 15:50:30.000000000 +0400
@@ -52,7 +52,7 @@ function dblog_schema() {
       ),
-        'length' => 255,
+        'length' => 1024,

diff -rupN /home_old/modules/dblog/dblog.module /home_new/modules/dblog/dblog.module
--- /home_old/modules/dblog/dblog.module	2013-03-26 16:04:28.000000000 +0400
+++ /home_new/modules/dblog/dblog.module	2013-03-26 15:51:10.000000000 +0400
@@ -145,7 +145,7 @@ function dblog_watchdog(array $log_entry
-      'link' => substr($log_entry['link'], 0, 255),
+      'link' => substr($log_entry['link'], 0, 1024),
orb’s picture

The problem is not here.
Previous module sends the string in two encodings - 8 and 16 bit.

See module pathauto or eq

IRuslan’s picture

I fall into similar problem.
For me error looks like:
PDOException: SQLSTATE[HY000]: General error: 1366 Incorrect string value: '\xD8' for column 'link'.
During insertion into watchdog table.
It's a some float problem (may be related to certain chars in arabic for me), and i think it's related to pathauto.
Value of link in my case it's a l('view', 'node/' . $node->nid). It comes from node_form_submit() during node creation.
I suppose that it's not substr() problem because link comes urlencoded and doesn't contain non-utf chars normally.
But for some reason in the middle of string there is a broken character, which could not be encoded, and then brake insertion.

Unfortunately, for now i have no solution.

damien tournoud’s picture

Version: 7.21 » 8.x-dev

#2 looks like a valid bug fix. It need to be applied to Drupal 8 first, could we get it forward ported?

damien tournoud’s picture

Issue summary: View changes

Added some more information that could help with the issue

periksson’s picture

Issue summary: View changes

I get the same exception, but for me it appears to be the REQUEST_URI and not the LINK:

Added:

function dblog_watchdog(array $log_entry) {
  print_r($log_entry);

And it appears that the Request URI is coded as latin1 but read as unicode:

    [request_uri] => http://[domain]/kalender/dansworkshop-�-introduktion-f�r-nyb�rjare

PHPs own $SERVER['REQUEST_URI'] seems to handle this much better:

    [REQUEST_URI] => /test.php?q=/kalender/dansworkshop--introduktion-f%C3%B6r-nyb%C3%B6rjare

Now this is something you actually can send to the database. :-)

Best

Eric

alexpott’s picture