#47703 [NEW]: ini file syntax not well documented

From: Date: Wed, 18 Mar 2009 07:17:19 +0000
Subject: #47703 [NEW]: ini file syntax not well documented
Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-1998@lists.php.net to get a copy of this message
From:             ctoomey at yahoo-inc dot com
Operating system: All
PHP version:      Irrelevant
PHP Bug Type:     Documentation problem
Bug description:  ini file syntax not well documented

Description:
------------
The legal syntax for PHP ini files (both php.ini and those parsed by
parse_ini_file()) is not really fully described anywhere in the manual.
It'd be helpful to have that documented say on
http://www.php.net/manual/en/configuration.file.php,
and then have the
parse_ini_file() and parse_ini_string() documentation pages link to that
syntax documentation.

There are bits and pieces of documentation, like in the comments of the
php.ini in Example 1 on the above page, and in the comments of the latest
php.ini in CVS.  Also, in the page for parse_ini_file(), it documents the
set of illegal words and characters for keys.  It also says certain
characters have "special meaning" in values, but doesn't say what those
meanings are / what they can be used for in values.

The lack of precise syntax documentation makes it hard to predict how
parse_ini_file() will actually treat a given ini file line (as an error, as
ok but with some odd value interpretation, or just silently ignore).  The
following examples illustrate; these are using 5.3.0-beta2 snapshot on
Windows.

			value of key "x" 
ini line		from parse_ini_file()
--------		---------------------
x = 'foo' ;blah		foo
	;; Single quotes are ok too?

# x = blah		N/A
	;; No keys parsed out for this line, and no syntax
	;; error reported -- is "#" a comment char.?

x = "foo" # test	foo# test
	;; Hmm, legal to have text after double quoted value
	;; and gets oddly appended to value.
	;; And no, guess "#" ISN'T a comment char.

foo bar car		N/A
	;; No keys parsed out for this line, and no syntax
	;; error reported.  What happened to it?


Reproduce code:
---------------
The above was done by varying the contents of test.ini and then running
the following command at the windows prompt:

% php -r "print_r(parse_ini_file('test.ini'));"


Expected result:
----------------
For most of the examples I expected syntax errors to be reported.  But the
larger issue is that without documentation of the legal syntax of ini
files, PHP users don't really know what's legal and what's not.


Actual result:
--------------
See above.


-- 
Edit bug report at http://bugs.php.net/?id=47703&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=47703&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=47703&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=47703&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=47703&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=47703&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=47703&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=47703&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=47703&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=47703&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=47703&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=47703&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=47703&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=47703&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=47703&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=47703&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=47703&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=47703&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=47703&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=47703&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=47703&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=47703&r=mysqlcfg



Thread (5 messages)

« previous php.doc.bugs (#1998) next »