php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #77589 Core dump using parse_ini_string with numeric sections
Submitted: 2019-02-08 19:36 UTC Modified: -
From: public at joaquinfernandez dot net Assigned:
Status: Closed Package: Filesystem function related
PHP Version: 7.3.2 OS: Linux
Private report: No CVE-ID: None
 [2019-02-08 19:36 UTC] public at joaquinfernandez dot net
Description:
------------
If ini string has numeric sections and INI_SCANNER_TYPED options is used, then i get segmentation fault.

But if numeric sections are enclosed in quotes (["0"], ["1"], etc) then no problem occurs.

Test script:
---------------
var_dump(
    parse_ini_string(
        <<<INI
[0]
a = 1
b = "2"
c = true

[1]
a = 0
b = "abc"
c = false
INI,
        TRUE,
        INI_SCANNER_TYPED
    )
);


Expected result:
----------------
array(2) {
  [0] =>
  array(3) {
    'a' =>
    int(1)
    'b' =>
    string(1) "2"
    'c' =>
    bool(true)
  }
  [1] =>
  array(3) {
    'a' =>
    int(0)
    'b' =>
    string(3) "abc"
    'c' =>
    bool(false)
  }
}


Actual result:
--------------
Segmentation fault

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2019-02-11 07:35 UTC] laruence@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=92055ca79b821d0712ed67b8173d2312e7e9fdbd
Log: Fixed bug #77589 (Core dump using parse_ini_string with numeric sections)
 [2019-02-11 07:35 UTC] laruence@php.net
-Status: Open +Status: Closed
 [2019-02-11 08:37 UTC] nikic@php.net
Automatic comment on behalf of laruence@gmail.com
Revision: http://git.php.net/?p=php-src.git;a=commit;h=92055ca79b821d0712ed67b8173d2312e7e9fdbd
Log: Fixed bug #77589 (Core dump using parse_ini_string with numeric sections)
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Mon Oct 14 08:01:27 2024 UTC