well well well.
forget everything from my last 2 mails, I'm an idiot.
the root cause of all my problems is that rcube_contacts->insert
returns the insert_id as an integer in RC 0.8 series and
as a string in rc 0.9 series.
so this code in step/addressbook/save :
if ($result) {
// LDAP DN change
if (is_string($result)
&& strlen($result)>1) {
$newcid = $result;
// change cid in POST for 'show' action
$_POST['_cid'] = $newcid;
}
doesn't create newcid in 0.8 but does in 0.9 leading to
malfunction.
so adding an explicit integer cast in my plugin on
plugin['result'] let me recover previous behaviour.
is it explicitely defined somewhere that rcube_contacts->insert
should return a string or an integer ?
regards,
Sebastien
Le 07/12/2013 19:21, Sébastien BLAISOT a écrit :
Maybe I found the reason behing this.
get_record has a design flaw I think :
When assoc=true and the given id doesn't exist (which can happend,
believe me :) ) then :
db_fetch_assoc is false, leading to empty record, and the
following line :
return $assoc && $record ? $record : $this->result;
returns $this->result which has not been updated. It takes the
result of the last search !
I think there is a algorithm error behind this.
can you confirm ?
End everything behind this is that contact modification can't
handle addressbook change in the middle of the process anymore,
which was possible before the introduction of roundcube framework.
sebastien
Le 07/12/2013 17:49, Sébastien BLAISOT a écrit :
Hi everybody,
since RC 0.9b, there is a bug in my automatic_addressbook plugin
when editing a contact with th move_to config option set to 1
This means that when editing a contact in the collected_abook,
it is saved in the default abook and removed from its original
collected_abook
(calling $CONTACTS->insert and setting abort to true and
result to the new cid)
the log is showing :
[07-Dec-2013 14:18:16 Europe/Paris] PHP Fatal error: Cannot use
object of type rcube_result_set as array in
/var/www/vhosts/ssl_common/webmail/test/rc09b/program/steps/addressbook/save.inc
on line 134
this seams to come from the following lines of code in
program/steps/addressbook/save :
$record = $CONTACTS->get_record($newcid ? $newcid : $cid,
true);
$record['email'] =
reset($CONTACTS->get_col_values('email', $record, true));
it seems to me that get_record return in general a record, but
can return in some circonstances a rcube_result_set object and
the next line of code can't handle this (array assignation on a
rcube_result_set object).
Can somebody confirme this ?
What are the condition for get_record to return an
rcube_result_set with only 1 object in it ?
I don't already understand very well what happens but I can make
additionnal tests to help debug this.
If you can confirme this seems to be a bug, I'll file a bug
report.
regards,
sebastien
_______________________________________________
Roundcube Development discussion mailing list
dev@lists.roundcube.net
http://lists.roundcube.net/mailman/listinfo/dev