#48719 [NEW]: parse_ini_file scanner more sanitation

[email protected] ("dragoonis at gmail dot com")
Newsgroups php.bugs
Message-ID <[email protected]>
From:             dragoonis at gmail dot com
Operating system: Linux (all affected)
PHP version:      5.3.0RC4
PHP Bug Type:     Unknown/Other Function
Bug description:  parse_ini_file scanner more sanitation

Description:
------------
The sanitation on the new parse_ini_file parameter names scanner mode
doesn't check if a valid scanner mode has been passed.

The patch has been applied below the if() for if (filename_len == 0) {.
The fix can be found here:
http://digiflexdev.com/php/parse_ini_file_fix.txt

The .phpt file for this is below
http://digiflexdev.com/php/parse_ini_file_test.txt
I realise the .phpt file is wrong somewhat this is my first bug report and
the .phpt file just shows.

The same issue applies to parse_ini_string, respectively.

Reproduce code:
---------------
<?php print_r(parse_ini_file('file.ini', false', INVALID_SCANNER_MODE));

Make a file named file.ini with the following in it.
data = 2

Expected result:
----------------
I'd expect to see a notice. and default to ZEND_INI_SCANNER_NORMAL which
is what my fix does.

Actual result:
--------------
Warning: parse_ini_file() expects parameter 3 to be long, string given in
/home/pdragoonis/php-5.3.0/sapi/cli/pd/parse_ini_file_test.php on line 3

-- 
Edit bug report at http://bugs.php.net/?id=48719&edit=1
-- 
Try a CVS snapshot (PHP 5.2):        http://bugs.php.net/fix.php?id=48719&r=trysnapshot52
Try a CVS snapshot (PHP 5.3):        http://bugs.php.net/fix.php?id=48719&r=trysnapshot53
Try a CVS snapshot (PHP 6.0):        http://bugs.php.net/fix.php?id=48719&r=trysnapshot60
Fixed in CVS:                        http://bugs.php.net/fix.php?id=48719&r=fixedcvs
Fixed in CVS and need be documented: http://bugs.php.net/fix.php?id=48719&r=needdocs
Fixed in release:                    http://bugs.php.net/fix.php?id=48719&r=alreadyfixed
Need backtrace:                      http://bugs.php.net/fix.php?id=48719&r=needtrace
Need Reproduce Script:               http://bugs.php.net/fix.php?id=48719&r=needscript
Try newer version:                   http://bugs.php.net/fix.php?id=48719&r=oldversion
Not developer issue:                 http://bugs.php.net/fix.php?id=48719&r=support
Expected behavior:                   http://bugs.php.net/fix.php?id=48719&r=notwrong
Not enough info:                     http://bugs.php.net/fix.php?id=48719&r=notenoughinfo
Submitted twice:                     http://bugs.php.net/fix.php?id=48719&r=submittedtwice
register_globals:                    http://bugs.php.net/fix.php?id=48719&r=globals
PHP 4 support discontinued:          http://bugs.php.net/fix.php?id=48719&r=php4
Daylight Savings:                    http://bugs.php.net/fix.php?id=48719&r=dst
IIS Stability:                       http://bugs.php.net/fix.php?id=48719&r=isapi
Install GNU Sed:                     http://bugs.php.net/fix.php?id=48719&r=gnused
Floating point limitations:          http://bugs.php.net/fix.php?id=48719&r=float
No Zend Extensions:                  http://bugs.php.net/fix.php?id=48719&r=nozend
MySQL Configuration Error:           http://bugs.php.net/fix.php?id=48719&r=mysqlcfg
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.