Mantis - Quercus
Viewing Issue Advanced Details
1966 minor always 08-22-07 23:55 11-16-07 18:29
ntherning  
 
normal  
closed 3.1.2  
fixed  
none    
none 3.1.4  
0001966: Drupal 5.2 + locale module + Swedish translation => StackOverflowError
The first request for a Swedish page will render almost ok. I had some issues with unicode characters not displaying correctly. The subsequent requests always cause a StackOverflowError.

On the first request for a Swedish node Drupal will read the sv texts from the locale_target table into a PHP associative array which it then serializes and saves to the cache table. Then it will generate the Swedish menu structure and serialize it and save to the cache_menu table. AFAICS the problem is when Drupal on the susequent requests tries to unserialize the previously serialized object from cache_menu. The unserialize fails and Drupal's menu functions loops indefinitely until StackOverflowError is generated.

If you have a look in the cache_menu blob you can clearly see that Swedish UTF-8 characters which normally occupy 2 bytes now need 4 bytes. The length field in the serialized strings are incorrect which I guess causes the problem with unserialize.

I've tried changing the function db_encode_blob() in includes/database.mysql.inc to

  return "x'" . bin2hex($data) . "'";

That change combined with settings all encoding properties to ISO8859-1 makes the data in cache_menu become ISO8859-1 encoded. The length fields in the serialized data are however still incorrect.

I've tried with all combinations of script-encoding, unicode.runtime_encoding and unicode.output_encoding. Setting all to ISO8859-1 solved the problems I had with the unicode characters not displaying correctly on the first request. But it didn't solve the problem with StackOverflowError.
I'm using the following JDBC URL otherwise I cannot save Swedish blog entries (I get an SQLException whenever I try to):

jdbc:mysql://localhost/db?useUnicode=true&characterEncoding=UTF-8 [^]

System info:
apache-tomcat-5.5.23
java version "1.6.0"
Java(TM) SE Runtime Environment (build 1.6.0-b105)
Java HotSpot(TM) Client VM (build 1.6.0-b105, mixed mode, sharing)
Ubuntu 7.04
Linux 2.6.20-15-generic 0000002 SMP Sun Apr 15 07:36:31 UTC 2007 i686 GNU/Linux

Notes
(0002225)
gjvc   
08-23-07 11:50   
This appears to be the same issue as 1955, using postgres.
(0002502)
mo   
11-16-07 18:29   
Closing since this issue is a duplicate of 1955. That issue
was just fixed in the Postgres DB layer. This fix will be
available in the next release.