Author Topic: 1.1.6 - SQL AddressBook - JobTitle disappears  (Read 989 times)

Offline Davis

  • Newbie
  • *
  • Posts: 6
1.1.6 - SQL AddressBook - JobTitle disappears
« on: November 14, 2016, 06:08:02 AM »
Hello,

I have hMailServer, Roundcube 1.1.6, IIS 8.5, Win2k12
Suddenly I've realized that several fields of contacts in address book does now shown in roundcube interface.
Main fields works fine: name, surname, phones, emails. Even suffixes and prefixes.
But, for example, jobtitle and department only shown once after fresh logging in. For any contact.
I.e.:
- at morning I log in under my account and open address book
- select ANY contact in book
- in shown contact info all fields visible
- select ANY other contact and there are no jobtitle and department info. Of course this info is in Vcards in SQL table
- I can select first contact again and it also now displayed without jobtitle and department info
After this I may log out/log in - no changes.
Only after some time, I cannot say exactly, I guess it is about 30-60 minutes, something resets and whole path can be reproduced.
I cannot understand what does it depend of.
This happens with personal SQL books and with global SQL book.
This remains with all plug-ins turned off.

Please help me fix this



Offline Davis

  • Newbie
  • *
  • Posts: 6
Re: 1.1.6 - SQL AddressBook - JobTitle disappears
« Reply #1 on: November 18, 2016, 10:41:09 AM »
Strange thing.
First I've found that changing any php file "resets" this bug and first selected contact shown OK.
Second. In file \program\lib\Roundcube\rcube_vcard.php after line 240 I've added some debug code:
Code: [Select]
else {
  $out[$key][] = $raw[0];
    if ($key == 'jobtitle') {
      write_log('Davis', '$out['.$key.']=' . print_r($out[$key], true));
      write_log('Davis', '$out[\'jobtitle\']: ' . print_r($out['jobtitle'], true));
    }
}
And after saving this php I select any contact in address book and got this log file:
Code: [Select]
[18-Nov-2016 17:29:00 +0200]: <vvmuutqp> $out[jobtitle]=Array
(
    [0] => Редактор контента
)

[18-Nov-2016 17:29:00 +0200]: <vvmuutqp> $out['jobtitle']: Array
(
    [0] => Редактор контента
)

[18-Nov-2016 17:29:00 +0200]: <vvmuutqp> $out[jobtitle]=Array
(
    [0] => Редактор контента
)

[18-Nov-2016 17:29:00 +0200]: <vvmuutqp> $out['jobtitle']:

As we can see function get_assoc() called twice. First time both debug commands show correct values for jobtitle.
But second time first debug command printed same value but second - empty value.
$out[$key] sees value but  $out['jobtitle'] - not
How it can be possible??

Offline Davis

  • Newbie
  • *
  • Posts: 6
Re: 1.1.6 - SQL AddressBook - JobTitle disappears
« Reply #2 on: November 21, 2016, 07:59:44 AM »
PHP 5.6.24
No ideas? :(

Offline Davis

  • Newbie
  • *
  • Posts: 6
Re: 1.1.6 - SQL AddressBook - JobTitle disappears
« Reply #3 on: November 21, 2016, 08:23:23 AM »
Ok next step:
now this code:
Code: [Select]
$out[$key][] = $raw[0];
if ($key == 'jobtitle') {
write_log('Davis', 'whole $out: ' . print_r($out, true));
$out['jobtitle'][0] = 'Davis:' . $raw[0];
write_log('Davis', 'whole $out after manual set: ' . print_r($out, true));
}
Gives me this amazing result:
Code: [Select]
[21-Nov-2016 16:15:17 +0300]: <013l7feb> whole $out: Array
(
    [name] => Имя
    [firstname] => Имя
    [surname] => Фамилия
    [phone:work] => Array
        (
            [0] => 123-56-78
        )

    [email:work] => Array
        (
            [0] => post@email.com
        )

    [jobtitle] => Array
        (
            [0] => Должность
        )

)

[21-Nov-2016 16:15:17 +0300]: <013l7feb> whole $out after manual set: Array
(
    [name] => Имя
    [firstname] => Имя
    [surname] => Фамилия
    [phone:work] => Array
        (
            [0] => 123-56-78
        )

    [email:work] => Array
        (
            [0] => post@email.com
        )

    [jobtitle] => Array
        (
            [0] => Должность
        )

    [jobtitle] => Array
        (
            [0] => Davis:Должность
        )

)
As we can see we have two 'jobtitle' keys.
What can be wrong with key value?
It have to be equal to 'jobtitle' both times but looks like it has different values

Offline Davis

  • Newbie
  • *
  • Posts: 6
Re: 1.1.6 - SQL AddressBook - JobTitle disappears
« Reply #4 on: November 22, 2016, 04:41:16 AM »
I do not know - why but after I've changed
Code: [Select]
$out[$key][] = $raw[0];to
Code: [Select]
$out[trim($key)][] = $raw[0];jobtitle became visible all time