php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #64650 parse_ini_file parse ini file
Submitted: 2013-04-15 09:52 UTC Modified: 2013-04-18 06:36 UTC
Votes:1
Avg. Score:2.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: eduosi at 163 dot com Assigned:
Status: Not a bug Package: Unknown/Other Function
PHP Version: 5.3Git-2013-04-15 (Git) OS:
Private report: No CVE-ID: None
 [2013-04-15 09:52 UTC] eduosi at 163 dot com
Description:
------------
Dear,

php version 5.3.0 or greater 5.3.0,

parse_ini_file() loads in the ini file specified in file, if param $scanner_mode equal 'INI_SCANNER_RAW' and option value contain ';', this value will be truncated.

Test script:
---------------
====== ini file ======
simple.ini

[db]
connectionString='mysql:dbname=db;host=127.0.0.1'
username='root'
passwrd=''

====== php script ======

<?php
  var_dump(parse_ini_file('simple.ini', TRUE, INI_SCANNER_RAW));

====== result ======
array(1) {
  ["db"]=>
  array(3) {
    ["connectionString"]=>
    string(17) "'mysql:dbname=db"
    ["username"]=>
    string(6) "'root'"
    ["password"]=>
    string(2) "''"
  }
}

====== I expect results ======

array(1) {
  ["db"]=>
  array(3) {
    ["connectionString"]=>
    string(17) "'mysql:dbname=db;host=127.0.0.1'"
    ["username"]=>
    string(6) "'root'"
    ["password"]=>
    string(2) "''"
  }
}



Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2013-04-15 17:10 UTC] pierrick@php.net
The current ini_parser implementations with INI_SCANNER_RAW only works with double 
quotes as string delimiter.
 [2013-04-18 06:36 UTC] ab@php.net
-Status: Open +Status: Not a bug
 [2013-04-18 06:36 UTC] ab@php.net
.... and it's clearly documented here http://de2.php.net/parse_ini_file

[quote]
Note: 

If a value in the ini file contains any non-alphanumeric characters it needs to be enclosed in double-quotes ("). 
[/quote]
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 02:01:30 2024 UTC