Jump to content

Topic on Extension talk:Pdf Export

Syntax error: "unexpected token" and "unexpected EOF"

2
Scottie33 (talkcontribs)

I noticed two errors when generating PDF files when title page (article) in the MediaWiki have "'" or "(", ")" characters:

  • Syntax error: "unexpected token"
  • "unexpected EOF"

For example, if the page title is "Foo_(bar)" then I get the following error message:

sh: -c: line 0: syntax error near unexpected token `('
sh: -c: line 0: `/usr/bin/mw-render --config http://mywiki/w/ --output /tmp/mw-pdf-lJVlIa --writer rl Foo_(bar)'

Second example, if page title is "Foo_BAR's", then I get the following error message:

sh: -c: line 0: unexpected EOF while looking for matching `
sh: -c: line 1: syntax error: unexpected end of file

Note This is also huge security issue, because users that can create new articles and render them via that extension, may be able to run certain shell commands on MediaWiki server. (source: mwlib mailing list)

I've using the following environment:

  • MediaWiki: 1.19.0
  • PdfExport: 3.0.1
  • CentOS: 6.3 (final)
  • * PHP: 5.3.3
Cneubauer (talkcontribs)

Yep, it's not escaping the shell argument properly. I'll commit a fix. Thanks for the report.

Reply to "Syntax error: "unexpected token" and "unexpected EOF""