Author Topic: roundcubemail-0.1-rc1 - DB Error and issue with MB String - Resolved w/ Patch  (Read 4757 times)

Offline preinheimer

  • Newbie
  • *
  • Posts: 7
I've got it set up (sort of, I can't figgure out how to tell it to connect to port 993 without hard coding it. But I get a series of errors when I log in.


Code: [Select]
DB Error in /var/www/mail.myserver.com/webmail2/roundcubemail-0.1-rc1/program/include/rcube_db.inc (505): DB Error: constraint violation Query: INSERT INTO messages (user_id, del, cache_key, created, idx, uid, subject, `from`, `to`, cc, date, size, headers, structure) VALUES (1, 0, 'INBOX.msg', now(), '533', '45714', '¨k¤H«ù¤[ªº¯µ³ZByxxxx', 'Bxxxxx¨k¤H¤£¥i¤£ª¾«ù¤[°T®§ ', 'zxxxxx@hotmail.com', '', FROM_UNIXTIME(-2147469249), 5353, 'O:14:\"iilBasicHeader\":25:{s:2:\"id\";s:3:\"533\";s:3:\"uid\";s:5:\"45714\";s:7:\"subject\";s:20:\"�k�H��[�����ZByhung\";s:4:\"from\";s:62:\"\"Byhung�k�H���i����

( ! ) Warning: mb_convert_encoding() [function.mb-convert-encoding]: Illegal character encoding specified in /var/www/mail.myserver.com/webmail2/roundcubemail-0.1-rc1/program/include/main.inc on line 924
Call Stack
# Time Memory Function Location
1 0.0013 131456 {main}( ) ../index.php:0
2 1.2040 4315044 rcmail_template->send( ) ../index.php:368
3 1.2040 4315044 rcmail_template->parse( ) ../rcmail_template.inc:172
4 1.2046 4324052 rcmail_template->parse_xml( ) ../rcmail_template.inc:259
5 1.2046 4324052 preg_replace ( ) ../rcmail_template.inc:385
6 1.2360 4373704 preg_replace ( ) ../rcmail_template.inc:385
7 1.2360 4374020 rcmail_template->xml_command( ) ../rcmail_template.inc(385) : regexp code:9
8 1.2361 4374020 call_user_func ( ) ../rcmail_template.inc:437
9 1.2361 4374020 rcmail_message_list( ) ../rcmail_template.inc:0
10 1.9883 4575348 rcube_imap::decode_mime_string( ) ../func.inc:461
11 1.9883 4575348 rcube_charset_convert( ) ../rcube_imap.inc:2183
12 1.9883 4575348 mb_convert_encoding ( ) ../main.inc:924


( ! ) Warning: mb_convert_encoding() [function.mb-convert-encoding]: Illegal character encoding specified in /var/www/mail.myserver.com/webmail2/roundcubemail-0.1-rc1/program/include/main.inc on line 924
Call Stack
# Time Memory Function Location
1 0.0013 131456 {main}( ) ../index.php:0
2 1.2040 4315044 rcmail_template->send( ) ../index.php:368
3 1.2040 4315044 rcmail_template->parse( ) ../rcmail_template.inc:172
4 1.2046 4324052 rcmail_template->parse_xml( ) ../rcmail_template.inc:259
5 1.2046 4324052 preg_replace ( ) ../rcmail_template.inc:385
6 1.2360 4373704 preg_replace ( ) ../rcmail_template.inc:385
7 1.2360 4374020 rcmail_template->xml_command( ) ../rcmail_template.inc(385) : regexp code:9
8 1.2361 4374020 call_user_func ( ) ../rcmail_template.inc:437
9 1.2361 4374020 rcmail_message_list( ) ../rcmail_template.inc:0
10 2.0590 4590576 rcube_imap::decode_mime_string( ) ../func.inc:461
11 2.0591 4590576 rcube_charset_convert( ) ../rcube_imap.inc:2183
12 2.0591 4590576 mb_convert_encoding ( ) ../main.inc:924


( ! ) Warning: Cannot modify header information - headers already sent in /var/www/mail.myserver.com/webmail2/roundcubemail-0.1-rc1/program/include/rcube_shared.inc on line 154
Call Stack
# Time Memory Function Location
1 0.0013 131456 {main}( ) ../index.php:0
2 1.2040 4315044 rcmail_template->send( ) ../index.php:368
3 1.2040 4315044 rcmail_template->parse( ) ../rcmail_template.inc:172
4 2.0710 4663336 rcmail_template->write( ) ../rcmail_template.inc:267
5 2.1124 4660920 rcube_html_page->write( ) ../rcmail_template.inc:224
6 2.1127 4696056 header ( ) ../rcube_shared.inc:154

running php 5.2.4
Code: [Select]
System Linux myserver.com 2.6.21-2-k7 #1 SMP Wed Jul 11 04:29:08 UTC 2007 i686
Build Date Sep 2 2007 17:19:45
Configure Command './configure' '--with-apxs2=/usr/local/apache2/bin/apxs' '--with-mysql' '--with-gd' '--enable-soap' '--with-libxml-dir=/usr/lib/' '--with-mysql-sock=/tmp' '--with-tidy' '--with-jpeg-dir=/usr/lib/' '--with-xsl' '--with-curl' '--with-snmp' '--with-freetype-dir=/usr/local/freetype2' '--with-zlib' '--enable-gd-native-ttf' '--with-openssl' '--enable-mbstring' '--with-mm'
Server API Apache 2.0 Handler
Virtual Directory Support disabled
Configuration File (php.ini) Path /usr/local/lib
Loaded Configuration File /usr/local/lib/php.ini
PHP API 20041225
PHP Extension 20060613
Zend Extension 220060519
Debug Build no
Thread Safety disabled
Zend Memory Manager enabled
IPv6 Support enabled
Registered PHP Streams php, file, data, http, ftp, compress.zlib, https, ftps
Registered Stream Socket Transports tcp, udp, unix, udg, ssl, sslv3, sslv2, tls
Registered Stream Filters string.rot13, string.toupper, string.tolower, string.strip_tags, convert.*, consumed, convert.iconv.*, zlib.*

Any hints on how I can resolve these?
Updates
I've posted my work-around for the mbstring issue in another thread under bugs. The full query that i'm getting the error on is:
Code: [Select]
INSERT INTO messages
    (user_id
 del
 cache_key
 created
 idx
 uid
 subject
 `from`
 `to`
 cc
 date
 size
 headers
 structure)
    VALUES (1
 0
 'INBOX.msg'
 now()
 '533'
 '45714'
 '¨k¤H«ù¤[ªº¯µ³ZByhung'
 'xxxxx¨k¤H¤£¥i¤£ª¾«ù¤[°T®§ '
 'xxxxx@hotmail.com'
 ''
 FROM_UNIXTIME(-2147469249)
 5353
 'O:14:\"iilBasicHeader\":25:{s:2:\"id\";s:3:\"533\";s:3:\"uid\";s:5:\"45714\";s:7:\"subject\";s:20:\"¨k¤H«ù¤[ªº¯µ³ZByhung\";s:4:\"from\";s:62:\"\"Byhung¨k¤H¤£¥i¤£ª¾«ù¤[°T®§\" \";s:2:\"to\";s:18:\"byhung@hotmail.com\";s:2:\"cc\";s:0:\"\";s:7:\"replyto\";s:62:\"\"Byhung¨k¤H¤£¥i¤£ª¾«ù¤[°T®§\" \";s:11:\"in_reply_to\";s:0:\"\";s:4:\"date\";s:31:\"Tue
 19 Jan 2038 11:14:07 +0800\";s:9:\"messageID\";s:41:\"\";s:4:\"size\";s:4:\"5353\";s:8:\"encoding\";s:0:\"\";s:5:\"ctype\";s:21:\"multipart/alternative\";s:5:\"flags\";s:18:\"Seen Deleted $Junk\";s:9:\"timestamp\";d:2147498047;s:1:\"f\";N;s:4:\"seen\";b:1;s:7:\"deleted\";b:1;s:6:\"recent\";b:0;s:8:\"answered\";b:0;s:4:\"junk\";N;s:12:\"internaldate\";s:20:\"05-Sep-2007 01:24:45\";s:8:\"is_reply\";N;s:3:\"bcc\";s:0:\"\";s:9:\"reference\";N;}'
 NULL)

The problematic line being FROM_UNIXTIME(-2147469249) my thinking is that there's insufficient sanity checking on that value before it's dumped into the DB. If I can backtrack it I will patch locally, but better solutions than an if(date is stupid) { date = now) thing i'm open to.

Backtrace:
Code: [Select]
( ! ) Exception: catch this mofo in /var/www/mail.paulhost.ca/webmail2/roundcubemail-0.1-rc1/program/include/rcube_db.inc on line 506
Call Stack
# Time Memory Function Location
1 0.0015 132564 {main}( ) ../index.php:0
2 2.6830 4319536 rcmail_template->send( ) ../index.php:368
3 2.6830 4319536 rcmail_template->parse( ) ../rcmail_template.inc:172
4 2.6839 4328544 rcmail_template->parse_xml( ) ../rcmail_template.inc:259
5 2.6839 4328544 preg_replace ( ) ../rcmail_template.inc:385
6 2.7149 4377732 preg_replace ( ) ../rcmail_template.inc:385
7 2.7149 4378048 rcmail_template->xml_command( ) ../rcmail_template.inc(385) : regexp code:9
8 2.7151 4378048 call_user_func ( ) ../rcmail_template.inc:437
9 2.7151 4378048 rcmail_message_list( ) ../rcmail_template.inc:0
10 2.7154 4378000 rcube_imap->list_headers( ) ../func.inc:311
11 2.7154 4378000 rcube_imap->_list_headers( ) ../rcube_imap.inc:508
12 3.0392 4432512 rcube_imap->_fetch_headers( ) ../rcube_imap.inc:581
13 3.1503 4544784 rcube_imap->add_message_cache( ) ../rcube_imap.inc:744
14 3.1519 4547088 rcube_db->query( ) ../rcube_imap.inc:2072
15 3.1519 4548140 rcube_db->_query( ) ../rcube_db.inc:183
16 3.1541 4589668 rcube_db->_add_result( ) ../rcube_db.inc:240

Offline preinheimer

  • Newbie
  • *
  • Posts: 7
Re: roundcubemail-0.1-rc1 - DB Error and issue with MB String - Updated
« Reply #1 on: September 06, 2007, 01:07:27 AM »
Patch.

rcube_db.inc
Line 480 - insert
   if ($timestamp > 2147483647)
   {
    $timestamp = 2147483646;
   }
Code: [Select]
function fromunixtime($timestamp)
  {
   //Check to see if timestamp is larger than the 32 bit integer max, if so reset to sane value, people from the future should have better ways to communicate anyways.
   if ($timestamp > 2147483647)
   {
    $timestamp = 2147483646;
   }
  switch($this->db_provider)
   {
   case 'mysqli':
   case 'mysql':
   case 'sqlite':
    return sprintf("FROM_UNIXTIME(%d)", $timestamp);

   default:
    return date("'Y-m-d H:i:s'", $timestamp);
   }
  }