seboettg / citeproc-php

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

Error "Object of class stdClass could not be converted to string" when rendering bibtex output #189

Closed hktang closed 1 month ago

hktang commented 1 month ago

Please follow the general troubleshooting steps first:

Bug reports:

It seems "licence" breaks bibtex rendering if it is an object. I am also not sure whether this is an issue with the Bibtex style or with citeproc. For now, as a workaround, I removed the "licence" key from the citeproc metadata object.

Used CSL stylesheet:

bibtex.csl

Used CSL metadata

I am quite sure it's caused by "licence" as I tried unsetting all stdClass objects one by one. The DOI I used for testing is 10.30852/sb.2023.2184 and below is an abridged version:

{
    "issue": "1",
    "license": [
        {
            "start": {
                "date-parts": [
                    [
                        2023,
                        6,
                        27
                    ]
                ],
                "date-time": "2023-06-27T00:00:00Z",
                "timestamp": 1687824000000
            },
            "content-version": "vor",
            "delay-in-days": 0,
            "URL": "https:\/\/creativecommons.org\/licenses\/by-nc\/4.0\/"
        }
    ],
    "content-domain": {
        "domain": [],
        "crossmark-restriction": false
    },
    "DOI": "10.30852\/sb.2023.2184",
    "type": "journal-article",
    "page": "87-101",
    "source": "Crossref",
    "is-referenced-by-count": 1,
    "title": "Climate change risk perceptions, vulnerability, and adaptation in high altitude farming regions of Hindu Kush Himalaya",
    "prefix": "10.30852",
    "volume": "13",
    "author": [
        {
            "ORCID": "http:\/\/orcid.org\/0000-0002-9242-3806",
            "authenticated-orcid": false,
            "given": "Saeed Ahmad",
            "family": "Asad",
            "sequence": "first",
            "affiliation": []
        }
    ],
    "published-online": {
        "date-parts": [
            [
                2023,
                6,
                27
            ]
        ]
    },
    "container-title": "Science Bulletin",
    "original-title": [],
    "score": 1,
    "subtitle": [],
    "short-title": [],
    "issued": {
        "date-parts": [
            [
                2023,
                6,
                27
            ]
        ]
    },
    "references-count": 42,
    "journal-issue": {
        "issue": "1"
    },
    "URL": "http:\/\/dx.doi.org\/10.30852\/sb.2023.2184",
    "relation": {},
    "subject": [],
    "published": {
        "date-parts": [
            [
                2023,
                6,
                27
            ]
        ]
    }
}
hktang commented 1 month ago

I think this is a duplicate of #184. Sorry!