Skip to content

htmlspecialchars(): Argument #1 ($string) must be of type string, array given #184

@hktang

Description

@hktang

Hi, I run into a TypeError when rendering BibTex format. Could you point me to where I should check?

General troubleshooting steps:

  • I read the README and followed the instructions.
  • I am sure that the used CSL metadata follows the CSL schema.
  • I use a valid CSL stylesheet

Bug reports:

  1. I retrieve citeproc-JSON metadata from DOI content negotiation.
  2. I feed it into citeProc and select "bibtex" as the output format.
  3. I receive the following error message for some publications:
htmlspecialchars(): Argument #1 ($string) must be of type string, array given in htmlspecialchars() 
(line 237 of /var/www/html/vendor/seboettg/citeproc-php/src/Rendering/Text.php).

For some other (less complex?) metadata, the bibtex output renders successfully.

Used CSL stylesheet:

bibtex.csl

Used CSL metadata

Below is the metadata I used (abstract and references removed).

[{
    "indexed": {
        "date-parts": [
            [
                2023,
                11,
                9
            ]
        ],
        "date-time": "2023-11-09T00:41:10Z",
        "timestamp": 1699490470291
    },
    "reference-count": 54,
    "publisher": "MDPI AG",
    "issue": "22",
    "license": [
        {
            "start": {
                "date-parts": [
                    [
                        2023,
                        11,
                        8
                    ]
                ],
                "date-time": "2023-11-08T00:00:00Z",
                "timestamp": 1699401600000
            },
            "content-version": "vor",
            "delay-in-days": 0,
            "URL": "https:\/\/creativecommons.org\/licenses\/by\/4.0\/"
        }
    ],
    "funder": [
        {
            "name": "Institute of Global Environmental Strategies, Hayama, Japan"
        }
    ],
    "content-domain": {
        "domain": [],
        "crossmark-restriction": false
    },
    "abstract": "",
    "DOI": "10.3390\/su152215733",
    "type": "journal-article",
    "created": {
        "date-parts": [
            [
                2023,
                11,
                8
            ]
        ],
        "date-time": "2023-11-08T12:02:05Z",
        "timestamp": 1699444925000
    },
    "page": "15733",
    "source": "Crossref",
    "is-referenced-by-count": 0,
    "title": "Monitoring G20 Countries\u2019 SDG Implementation Policies and Budgets Reported in Their Voluntary National Reviews (VNRs)",
    "prefix": "10.3390",
    "volume": "15",
    "author": [
        {
            "ORCID": "http:\/\/orcid.org\/0000-0002-1651-7843",
            "authenticated-orcid": false,
            "given": "Mark",
            "family": "Elder",
            "sequence": "first",
            "affiliation": [
                {
                    "name": "Institute for Global Environmental Strategies, Hayama 240-0115, Japan"
                }
            ]
        },
        {
            "ORCID": "http:\/\/orcid.org\/0000-0003-0671-5026",
            "authenticated-orcid": false,
            "given": "Elli",
            "family": "Newman",
            "sequence": "additional",
            "affiliation": [
                {
                    "name": "Energy Innovation, San Francisco, CA 94111, USA"
                }
            ]
        }
    ],
    "member": "1968",
    "published-online": {
        "date-parts": [
            [
                2023,
                11,
                8
            ]
        ]
    },
    "container-title": "Sustainability",
    "original-title": [],
    "language": "en",
    "link": [
        {
            "URL": "https:\/\/www.mdpi.com\/2071-1050\/15\/22\/15733\/pdf",
            "content-type": "unspecified",
            "content-version": "vor",
            "intended-application": "similarity-checking"
        }
    ],
    "deposited": {
        "date-parts": [
            [
                2023,
                11,
                8
            ]
        ],
        "date-time": "2023-11-08T12:31:10Z",
        "timestamp": 1699446670000
    },
    "score": 1,
    "resource": {
        "primary": {
            "URL": "https:\/\/www.mdpi.com\/2071-1050\/15\/22\/15733"
        }
    },
    "subtitle": [],
    "short-title": [],
    "issued": {
        "date-parts": [
            [
                2023,
                11,
                8
            ]
        ]
    },
    "references-count": 54,
    "journal-issue": {
        "issue": "22",
        "published-online": {
            "date-parts": [
                [
                    2023,
                    11
                ]
            ]
        }
    },
    "alternative-id": [
        "su152215733"
    ],
    "URL": "http:\/\/dx.doi.org\/10.3390\/su152215733",
    "relation": {},
    "ISSN": [
        "2071-1050"
    ],
    "subject": [
        "Management, Monitoring, Policy and Law",
        "Renewable Energy, Sustainability and the Environment",
        "Geography, Planning and Development",
        "Building and Construction"
    ],
    "container-title-short": "Sustainability",
    "published": {
        "date-parts": [
            [
                2023,
                11,
                8
            ]
        ]
    }
}]

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions