seboettg / citeproc-php

Full-featured CSL 1.0.1 processor for PHP
MIT License
73 stars 38 forks source link

Locator l. 30, getCitationItemById(), Context->citationItems is null for bibliography (OK for citation) #170

Open glorieux-f opened 10 months ago

glorieux-f commented 10 months ago

Please follow the general troubleshooting steps first:

Bug reports:

PHP Fatal error:  Uncaught Error: Call to a member function filter() on null in …/citeproc-php/src/Context.php:439
Stack trace:
#0 …/citeproc-php/src/Constraint/Locator.php(30): Seboettg\CiteProc\Context->getCitationItemById('ID001')
#1 …/citeproc-php/src/Constraint/AbstractConstraint.php(91): Seboettg\CiteProc\Constraint\Locator->matchForVariable('page', Object(stdClass))

I have not understood the logic. Fast hack, if ($context->isModeCitation()) in Locator.

Used CSL stylesheet:

nouvelles-perspectives-en-sciences-sociales.csl

Used CSL metadata

[ { "id": "ID001", "type": "article-journal", "title": "A title" } ]