WordPress.org

Make WordPress Core

Opened 3 months ago

Last modified 3 months ago

#23822 new defect (bug)

Invalid Plugin Contributors JSON from WP.org Plugin API

Reported by: bpetty Owned by:
Priority: normal Milestone: WordPress.org
Component: WordPress.org site Version:
Severity: normal Keywords:
Cc: bpetty

Description

Under some rare conditions, some plugins can break the plugin API with invalid JSON, specifically in regards to the list of contributors returned. This is likely because of the string encoding used to either parse or store the values returned from the plugin file headers.

Basically though, it results in using a null name for a JSON object member where there absolutely needs to be a string.

For example, the "Aaaaah Lek Lek" plugin (aaaaaaah-lek-lek) returns the following JSON:

{
    "name": "Aaaaah Lek Lek",
    "slug": "aaaaaaah-lek-lek",
    "version": "1.0",
    "author": "<a href=\"http:\/\/valeriosouza.com.br\">Val&#233;rio Souza<\/a>",
    "author_profile": "http:\/\/profiles.wordpress.org\/valeriosza",
    "contributors": {
        null: ""
    },
    "requires": "3.0.1",
    "tested": "3.5.1",
    "compatibility": [
        
    ],
    "rating": 0,
    "num_ratings": 0,
    "downloaded": 20,
    "last_updated": "2013-03-12",
    "added": "2013-03-12",
    "homepage": "http:\/\/valeriosouza.com.br",
    "sections": {
        "description": "<p>Coloque a frase da m&#250;sica LekLek em seu WordPress, dentro do painel administrativo.<\/p>",
        "installation": "<p>Siga para Instalar<\/p>\n\n<ol>\n<li>Fa&#231;a Upload <code>aaaaaaah-lek-lek<\/code> para a pasta <code>\/wp-content\/plugins\/<\/code><\/li>\n<li>Ative no menu 'Plugins' no seu WordPress<\/li>\n<\/ol>",
        "changelog": "<h4>1.0<\/h4>\n\n<ul>\n<li>Lan&#231;ada Vers&#227;o 1.<\/li>\n<\/ul>",
        "faq": "<h4>What about foo bar?<\/h4>",
        "other_notes": "<h3>Arbitrary section<\/h3>"
    },
    "short_description": "Coloque o Lek Lek no seu WordPress",
    "download_link": "http:\/\/downloads.wordpress.org\/plugin\/aaaaaaah-lek-lek.zip",
    "tags": {
        "frases": "frases",
        "leklek": "leklek"
    }
}

JSONLint comes back with:

Parse error on line 7:
...ibutors": {        null: ""    },    
----------------------^
Expecting 'STRING', '}'

These plugin details come from these files:

(it mentions a stable tag, but there are no actual tags)

You might also notice that Extend is unable to display these details correctly either: http://wordpress.org/extend/plugins/aaaaaaah-lek-lek/

Change History (1)

comment:1 SergeyBiryukov3 months ago

FWIW, that readme.txt file is in Windows-1252 instead of UTF-8.

Note: See TracTickets for help on using tickets.