Results 1 to 3 of 3

Thread: Discovered limitation in .ini file comments (semicolons versus pound signs / hashes,

  1. #1
    Join Date
    Apr 2008
    Posts
    23

    Default Discovered limitation in .ini file comments (semicolons versus pound signs / hashes,

    It looks like if you put parentheses() in comments that start with a # in your .ini file, it'll ignore everything in the file after that line.

    Looking at the parse_ini_file() documentation on php.net, it looks like the actual way to make a comment is to start the line with a semicolon ( ; )

    I don't know where I got the idea to use the hash (#), I think I saw it in the documentation somewhere.

    It seems to work, using the hash, but not if you put parentheses in it.

    For example, set the DB_SEE_INI setting to "true" and then try loading this in your ini:

    Code:
    [special_fields]
    # this is a comment with a (parenthesis)
    next_form =  "/formproc/templates/repairform2.html"
    bad_url = "/formproc/fmbadhandler.php"
    bad_template = "/formproc/template/error_template.html"
    
    logfile = "repair1.log"
    template_list_sep = ",  "
    It will indicate that no parameters were loaded.

    But if you change it to this:

    Code:
    [special_fields]
    ; this is a comment with a (parenthesis)
    next_form =  "/formproc/templates/repairform2.html"
    bad_url = "/formproc/fmbadhandler.php"
    bad_template = "/formproc/template/error_template.html"
    
    logfile = "repair1.log"
    template_list_sep = ",  "
    Or, to this:

    Code:
    [special_fields]
    # this is a comment without parentheses
    next_form =  "/formproc/templates/repairform2.html"
    bad_url = "/formproc/fmbadhandler.php"
    bad_template = "/formproc/template/error_template.html"
    
    logfile = "repair1.log"
    template_list_sep = ",  "
    It'll be fine.

    Just thought I'd share what I found, as it was a real pain in the @$$ to track down!

  2. #2
    Join Date
    Dec 2003
    Posts
    3,980

    Default Re: Discovered limitation in .ini file comments (semicolons versus pound signs / hash

    Hi,

    According to the PHP official documentation on parse_ini_file (which is what FormMail uses), there's no mention of '#' for comments. Comments only begin with ';'.

    The behaviour your seeing with '#' is quite interesting!

    If you've found any examples of our documentation using # for comments in INI files, please let me know and we'll correct them.
    Russell Robinson - Author of Tectite FormMail and FormMailDecoder
    http://www.tectite.com/

  3. #3
    Join Date
    Apr 2008
    Posts
    23

    Default Re: Discovered limitation in .ini file comments (semicolons versus pound signs / hash

    Yes, it's funny. I've been using them all along and they haven't seemed to cause a problem! Perhaps php just ignored them since it didn't know what to do with them LOL.

    But the parentheses introduced something that buggered it up.

    I don't know where I got the idea, perhaps it was just a guess, since it's a common way to do one-line comments in some languages (like Perl, I think).

    Well, now I know the right way to do it.

    Maybe it would be helpful to mention on the .ini doc that comments are specified with semicolons, and whitespace is OK.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Formmail ini file
    By Wayne Hammond in forum Features Questions
    Replies: 5
    Last Post: 28-Jun-2006, 02:05 PM
  2. Limitation on CSV column number?
    By BLFields in forum FormMail Subscription Support
    Replies: 3
    Last Post: 17-Sep-2004, 06:11 AM
  3. Thanks and comments
    By dedide in forum FormMail Subscription Support
    Replies: 1
    Last Post: 08-Jan-2004, 04:10 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •