seboettg / citeproc-php

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

[Bibtex] Error: Call to a member function getLanguage() on null #190

Open hktang opened 1 month ago

hktang commented 1 month ago

Please follow the general troubleshooting steps first:

Bug reports:

Related to #184 , It seems CiteProc::getContext()->getLocale() is null when using bibtex.csl.

strtok(CiteProc::getContext()->getLocale()->getLanguage(), '-');

Proposal is to supply the default locale "en" if it does not exist, because strtok does not accept null any more.

strtok(CiteProc::getContext()->getLocale()?->getLanguage() ?? "en", '-');