Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Built-in SQL Addressbook display/edit errors #4379

Closed
rcubetrac opened this issue Oct 31, 2013 · 16 comments
Closed

Built-in SQL Addressbook display/edit errors #4379

rcubetrac opened this issue Oct 31, 2013 · 16 comments

Comments

@rcubetrac
Copy link

Reported by aberglund on 31 Oct 2013 16:37 UTC as Trac ticket #1489407

Using latest git-master, SQL address book won't display contact details. Auto-complete works, and the contact list shows all personal contacts. But attempting to look at contact properties delivers a blank page, status message states "The requested contact was not found".

Error log states:
"PHP Fatal error: Using $this when not in object context in /.../master/program/lib/Roundcube/rcube_ldap.php on line 1523"

Tried re-initializing database and importing contacts fresh. Import worked, but contact properties still don't display, same errors.

Migrated-From: http://trac.roundcube.net/ticket/1489407

@rcubetrac
Copy link
Author

Comment by @alecpl on 31 Oct 2013 19:59 UTC

It was fixed in 4c02ef0.

@rcubetrac
Copy link
Author

Status changed by @alecpl on 31 Oct 2013 19:59 UTC

new => closed

@rcubetrac
Copy link
Author

Milestone changed by @alecpl on 31 Oct 2013 19:59 UTC

later => 1.0-beta

@rcubetrac
Copy link
Author

Comment by aberglund on 31 Jan 2014 17:33 UTC

This problem is again happening in yesterday's 1.0-rc release. Installed it using a copy of my production DB from 0.9.5, ran schema update from web installer. As was initially reported, auto-complete works fine, but contacts can not be displayed or deleted. Importing new contacts works fine, but again, no contacts will display.

@rcubetrac
Copy link
Author

Status changed by aberglund on 31 Jan 2014 17:33 UTC

closed => reopened

@rcubetrac
Copy link
Author

Milestone changed by aberglund on 31 Jan 2014 18:04 UTC

1.0-beta => 1.0-stable

@rcubetrac
Copy link
Author

Comment by @alecpl on 3 Feb 2014 07:51 UTC

Works for me. Any errors in log? Did you try with disabled plugins?

@rcubetrac
Copy link
Author

Comment by aberglund on 3 Feb 2014 16:42 UTC

No errors in logs, either in errors or sql. Disabling all plugins (almost all of which are core) does not help. The only Addressbook operations that I can perform are Add, Import and Export. Oddly, if I add a contact (either manually or via Vcard import), the entire addressbook suddenly works perfectly, until I leave the page and go back. Once I reload the Addressbook page, the error returns.

I also tried with a fresh, empty database, initialized using the web installer. After importing addresses (Vcard), the same behavior is seen. All works fine until I reload the Addressbook page.

I've determined another way to make it work - if I click to load one of our read-only LDAP books, then go back to my personal SQL book, it then works correctly again, until I next reload the page.

Are there any other things I should look for to help track down what is happening?

@rcubetrac
Copy link
Author

Comment by @alecpl on 4 Feb 2014 07:40 UTC

So, your problem is not working contacts listing? From the description it looks that it might be related with the data, but I'm curious why there's no error in log. Maybe check http server logs. Try to split the vcard import to smaller chunks, import them one-by-one to see if which chunk breaks the listing. How many contacts do you have? Can you reproduce this with small number of contacts? Also check if it works with disabled LDAP address books.

@rcubetrac
Copy link
Author

Comment by aberglund on 4 Feb 2014 17:28 UTC

Alec, please excuse my poor description of the problem. The contact list is displayed properly every time. The problem is that when you load the Addressbook page and then attempt to select a personal contact (to view details or edit) the error is displayed, and no contact data is shown.

This is 100% reproducible, with any user, or any number of personal contacts. Removing all LDAP books did not correct the issue.

Adding a contact - either individual or import - works perfectly.

I've found that the problem is apparent on first load of the addressbook page. Performing any operation on that page that prompts a refresh of the contact list fixes the problem, until you leave the addressbook page and return. So if I load the addressbook page and immediately select a single contact, I will receive the error. But if I load the addressbook page and do any operation that refreshes the contact list (such as click the Personal Addresses icon), all further operation on that page work correctly.

I still have seen no errors in any of the logs, But I have now seen what appears to be an anomaly in the sql log when this happens. Here are some log snippets:

Load the address book page - this appears to be correct.

[09:20:32 -0800](04-Feb-2014): [SELECT vars, ip, changed, now() AS ts FROM session WHERE sess_id = 'engdkntpi0ev1bpolag4sqfa63';
[04-Feb-2014 09:20:32 -0800](1]): [SELECT * FROM users WHERE user_id = '4';
[04-Feb-2014 09:20:32 -0800](2]): [SELECT * FROM contacts AS c WHERE c.del<>1 AND c.user_id='4' ORDER BY CONCAT(c.surname, c.firstname, c.name, c.email) ASC LIMIT 50;
[04-Feb-2014 09:20:32 -0800](3]): [UPDATE session SET changed = now(), vars = 'bGFuZ3Vh... [truncated 1774 bytes](4]);

Contact request that delivers the error.

[09:21:16 -0800](04-Feb-2014): [SELECT vars, ip, changed, now() AS ts FROM session WHERE sess_id = 'engdkntpi0ev1bpolag4sqfa63';
[04-Feb-2014 09:21:16 -0800](1]): [SELECT * FROM users WHERE user_id = '4';

Refresh the contact list:

[04-Feb-2014 09:22:12 -0800](2]): [SELECT vars, ip, changed, now() AS ts FROM session WHERE sess_id = 'engdkntpi0ev1bpolag4sqfa63';
[04-Feb-2014 09:22:12 -0800](1]): [SELECT * FROM users WHERE user_id = '4';
[04-Feb-2014 09:22:12 -0800](2]): [SELECT * FROM contacts AS c WHERE c.del<>1 AND c.user_id='4' ORDER BY CONCAT(c.surname, c.firstname, c.name, c.email) ASC LIMIT 50;

Successful display of a contact:

[04-Feb-2014 09:23:15 -0800](3]): [SELECT vars, ip, changed, now() AS ts FROM session WHERE sess_id = 'engdkntpi0ev1bpolag4sqfa63';
[04-Feb-2014 09:23:15 -0800](1]): [SELECT * FROM users WHERE user_id = '4';
[04-Feb-2014 09:23:15 -0800](2]): [SELECT * FROM contacts WHERE contact_id='62506' AND user_id='4' AND del<>1;
[04-Feb-2014 09:23:15 -0800](3]): [4] SELECT * FROM contactgroups WHERE del<>1 AND user_id='4' ORDER BY name;

Note that a contact request that throws the error never queries the DB for the contact info.

Again, this is 100% reproducible, for any user, any number of contacts, plugins disabled, no LDAP, and whether the DB was upgraded from 0.9.5 or a fresh initialized DB.

Environment - CentOS 5 (fully patched), MySQL 5.0.95, PHP 5.3.3, Apache 2.2.3

@rcubetrac
Copy link
Author

Comment by @alecpl on 4 Feb 2014 17:47 UTC

Define "the error is displayed". Try with different browser. Check browser console for javascript errors. Try to find a difference in http request data of working and non-working page.

@rcubetrac
Copy link
Author

Comment by aberglund on 4 Feb 2014 18:04 UTC

The same error as described originally, and shown in the screenshot I'm attaching now.

Reproducible in both Macs and Windows, all tested browsers - Safari, Firefox, IE, Chrome.

No javascript errors are logged in consoles. It appears to me as though the query for contact info is simply never sent.

@rcubetrac
Copy link
Author

Comment by @alecpl on 4 Feb 2014 18:21 UTC

I have no more ideas other that checking http request content or debugging code in steps/addressbook/show.inc (lines 22-30).

@rcubetrac
Copy link
Author

Comment by aberglund on 4 Feb 2014 20:33 UTC

I believe I have found the cause. I had the following explicitly defined in config.inc.php:

$config[= 0;

The defaults.inc.php has the following:

// Defines address book (internal index) to which new contacts will be added
// By default it is the first writeable addressbook.
// Note: Use '0' for built-in address book.
$config['default_addressbook']('default_addressbook']) = null;

If that param is defined as '0', the problem occurs. If I remove that line in config, all works as it should.

Apparently, the default of 'NULL' still selects the built-in addressbook. But declaring it explicitly by using '0' causes some sort of issue on page load, as if the addressbook listings have not been completely initialized.

@rcubetrac
Copy link
Author

Comment by @alecpl on 5 Feb 2014 07:38 UTC

0 and '0' is not the same. Fixed in a35540c.

@rcubetrac
Copy link
Author

Status changed by @alecpl on 5 Feb 2014 07:38 UTC

reopened => closed

@rcubetrac rcubetrac added this to the 1.0.0 milestone Mar 20, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant