In the Skinr Advanced Help file skinr/help/skinr.help.ini there is indentation for sections in the file. The indenting is done with double spaces and when the current version of Advanced Help is enabled, it throws a syntax error:

warning: syntax error, unexpected END_OF_LINE, expecting '=' in ./sites/default/modules/skinr/help/skinr.help.ini on line 10 in./sites/default/modules/advanced_help/advanced_help.module on line 667.

The ini file looks like this:

[overview]
title = "Overview"
weight = 0

[syntax]
title = "Syntax"
weight = 1

  [css-js]
  title = "CSS, Stylesheets & JavaScript"
  parent = syntax
  weight = 1

  [features]
  title = "Features"
  parent = syntax
  weight = 2

  [templates]
  title = "Templates"
  parent = syntax
  weight = 5

  [examples]
  title = "Examples"
  parent = syntax
  weight = 6

Removing or replacing the double spaces with tabs causes the error to go away. Is this a bug with Advanced Help or should the .ini files not have indented sections?

There is a related issue in the Skinr queue:

#797410: "syntax error" reported in '.../skinr.help.ini'

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

merlinofchaos’s picture

Advanced Help just calls parse_ini_file() to parse the file. That may be a bug (or at least inconsistency) of parse_ini_file that it wants tab indentation. =(

fgm’s picture

Status: Active » Postponed (maintainer needs more info)

I just tested the code above and it causes no error in the current advanced_help, or actually in a straight use of parse_ini.

What I suspect is that the .ini file is really missing a final LF character (some editors tend to do that).

Can you reproduce the problem without changing tabs/spaces, but adding a LF at the end of the file ? There are all sorts of issues boiling down to how fgets() in the standard C library behaves with files not ending with a LF.

Jacine’s picture

Oh, I didn't realize this issue existed. Sorry, I must have missed it.

I'm pretty sure the line endings are LF. I've attached the file, which I created in TextMate (along with my settings). I also attached a screenshot of the error. It only happens on admin/advanced_help (screenshot is from D7 btw, but it was the same in D6).

Anyway, this is really not a big deal, I just stopped indenting, problem solved ;)

fgm’s picture

Hi, the issue is typically not with the line endings themselves, but with the lack of a new line after the last variable. Normally, just adding one empty line at the end of the file should fix the issue, even with indenting.

fgm’s picture

Status: Postponed (maintainer needs more info) » Fixed

Fixed as seen on Skinr issue queue.

Status: Fixed » Closed (fixed)

Automatically closed -- issue fixed for 2 weeks with no activity.