INI file handling - strange things
| From: | Stanislav Malyshev | Date: | Wed, 12 Apr 2000 22:11:07 +0000 |
| Subject: | INI file handling - strange things | ||
| Groups: | php.dev | ||
| Request: | Send a blank email to php-dev+get-17847@lists.php.net to get a copy of this message | ||
I've looked recently in INI file handling in PHP and found rather strange
things:
There's a function parse_ini_file, which is accessible from PHP scripts.
This function seems to parse PHP-syntax INI file and put it in a hash. But!
It does a lot more. For example, if you have line like 'extension=name' in
the file, it would load 'name' as shared library! That's pretty surprising
to anyone trying to use it as an INI file parser...
Also, zend_extension_* items are handled separately even by the scanner,
though I really don't understand why they should. Why is it bad to take them
from configuration hash, and generalize INI-file handling?
Also, [sections] are recognized by the parser - but only to forget them
immediately, unless we parse browscap.ini file. What's bad in remembering
them, in one way or another, if we already parse them anyway?
Also, separate zend_extension handling seems to allow user to load arbitrary
DLLs via parse_ini_file, having defined a couple of symbols in them.
zend_load_extension seems to ignore any safety belts PHP has for user-loaded
libraries and just fetches the thing in.
Having inside INI file parser would be a great boon for developers, since it
is pretty common task in many applications. But, if this function is
presented as a part of PHP, it certainly should not do any weird things,
like automatically load DLLs, and if it isn't, it shouldn't be in PHP
functions, but used as internal one only.
Could someone enlighten me abouth the above - is it OK and I'm missing
something or is it broken and needs fixing?