dwp-forge / refnotes

4 stars 6 forks source link

Refnotes with enabled reference database (data plugin) throws PHP-errors #22

Closed dwp-forge closed 9 years ago

dwp-forge commented 9 years ago
What steps will reproduce the problem?
1. Clean install of dokuwiki, sqlite, data and refnotes plugins
2. add a bunch (in my case about 800) of pages to refnotes:cite, each page with a data
entry for one source
3. on the refnotes configuration page, activate "enable reference database"
4. cite one of the added pages
5. try to browse the page where the citation was added

What is the expected output? What do you see instead?
a) I would expect a rendered dokuwiki page.

b) Instead I just get a blank page (Firefox) or a http 500 error message (Chromium).

php_error.log says: "PHP Fatal error:  Call to a member function addField() on a non-object
in /var/www/dw/lib/plugins/refnotes/bibtex.php on line 388" 

If I deactivate the reference database on the refnotes configuration page, the pages
are rendered again (of course without the proper citation). 

What version of the product are you using? On what operating system?
- dokuwiki Angua or Adora Belle RC1 (Linux Mint 12)
- refnotes v2012-07-15
- sqlite & data plugin developer versions (because of sqlite3 support)

Please provide any additional information below.
The pages in refnotes:cite are created by an external script, a typical entry looks
like this: 

---- dataentry refnotes----
type        : refnotes
bibtextype  : article
note-name   : cite:Gallandi1882Stadtgeschlechter1
author      : Gallandi, J.
title       : Königsberger Stadtgeschlechter [Teil 1]
journal     : Altpreußische Monatsschrift
volume      : 19
published   : 1882
pages       : 26–65
url_page    : refnotes:cite:gallandi1882stadtgeschlechter1
weblink_url : http://books.google.com/books?id=l0YFAAAAQAAJ
file_imgs   : lit:gallandi1882stadtgeschlechter1.pdf
----

There are other things on these pages as well (code-section, backlinks, include of
other files) but according to the documentation this shouldn't matter. I can provide
the pages if this helps to solve the problem. Any advice is greatly appreciated.

Regards,
Frank

Original issue reported on code.google.com by frank.ellebrecht on 2012-10-03 07:38:55

dwp-forge commented 9 years ago
Which PHP version do you use?

Original issue reported on code.google.com by dwp-forge on 2012-10-03 08:36:34

dwp-forge commented 9 years ago
PHPInfo says:

PHP Version 5.3.6-13ubuntu3.9

Original issue reported on code.google.com by frank.ellebrecht on 2012-10-03 08:48:58

dwp-forge commented 9 years ago
I tried Adora Belle and PHP 5.4 -- everything seems to work fine.

The error comes from BibTeX parser, so I don't think data entries are relevant here.
You should have a code section with BibTeX data on one of pages in reference database.
It would help to have that code to debug the problem. The error basically says that
we found a field outside of an entry, which should not be possible since we start looking
for the fields only inside of the entries. For BibTeX parsing I use DokuWiki parser
with different set of rules, so the parser itself is very robust and tested a lot.
It's probably something with the rules, but they also look fine to me.

In principle, you could add "if ($this->entry != NULL)" at the start of line 388. That
should prevent the crash, but will not fix the underlying issue.

Anyway, I guess I won't make much progress on this without BibTeX code that causes
the crash.

Original issue reported on code.google.com by dwp-forge on 2012-10-21 14:16:02

dwp-forge commented 9 years ago
Thanks for your reply. With the supplied information I was finally able
to find the error. It's not a bug in refnotes, it was me who made the
mistake. There are some documentation pages in the refnotes namespace
with explanations on how to use certain Bibtex-types. In one of them I
missed the closing curly brace for an example Bibtex-entry. I didn't
think about it that from refnotes point of view it has to be a valid
entry. That's it, buggy human ;-) I just moved the documentation into
another namespace outside refnotes'. Everything is fine now. 

Sorry to have bothered you. Thank you very much for your time and the
work you've done.

Original issue reported on code.google.com by frank.ellebrecht on 2012-10-21 21:57:12

dwp-forge commented 9 years ago
You are welcome :)

Original issue reported on code.google.com by dwp-forge on 2012-10-22 07:45:13