#40752 [NEW]: parse_ini_file() segfaults when a scalar setting is redeclared as an array

From: Date: Thu, 08 Mar 2007 00:13:41 +0000
Subject: #40752 [NEW]: parse_ini_file() segfaults when a scalar setting is redeclared as an array
Groups: php.bugs 
Request: Send a blank email to php-bugs+get-110075@lists.php.net to get a copy of this message
From: hubert dot roksor at gmail dot com Operating system: PHP version: 5.2.1 PHP Bug Type: Reproducible crash Bug description: parse_ini_file() segfaults when a scalar setting is redeclared as an array Description: ------------ Using [] in a key name can result in a crash if the corresponding setting was previously set to a scalar value. Reproduce code: --------------- // Not relevant to the bug $file = tempnam('./', ''); file_put_contents($file, ' foo =1; foo[]=1; '); // Will make PHP crash parse_ini_file($file); Expected result: ---------------- In the attached reproduce code we create a ini file which has 2 keys, "foo" and "foo[]" then we execute parse_ini_file() on the newly-created file. Because "Characters {}|&~![()" must not be used anywhere in the key" (dixit the manual) I'd expect an error message, or at least a Strict notice. Actual result: -------------- PHP segfaults/crashes (tested on 5.2.1 on WinXP and 5.1.2 on Ubuntu 6.06) -- Edit bug report at http://bugs.php.net/?id=40752&edit=1 -- Try a CVS snapshot (PHP 4.4): http://bugs.php.net/fix.php?id=40752&r=trysnapshot44 Try a CVS snapshot (PHP 5.2): http://bugs.php.net/fix.php?id=40752&r=trysnapshot52 Try a CVS snapshot (PHP 6.0): http://bugs.php.net/fix.php?id=40752&r=trysnapshot60 Fixed in CVS: http://bugs.php.net/fix.php?id=40752&r=fixedcvs Fixed in release: http://bugs.php.net/fix.php?id=40752&r=alreadyfixed Need backtrace: http://bugs.php.net/fix.php?id=40752&r=needtrace Need Reproduce Script: http://bugs.php.net/fix.php?id=40752&r=needscript Try newer version: http://bugs.php.net/fix.php?id=40752&r=oldversion Not developer issue: http://bugs.php.net/fix.php?id=40752&r=support Expected behavior: http://bugs.php.net/fix.php?id=40752&r=notwrong Not enough info: http://bugs.php.net/fix.php?id=40752&r=notenoughinfo Submitted twice: http://bugs.php.net/fix.php?id=40752&r=submittedtwice register_globals: http://bugs.php.net/fix.php?id=40752&r=globals PHP 3 support discontinued: http://bugs.php.net/fix.php?id=40752&r=php3 Daylight Savings: http://bugs.php.net/fix.php?id=40752&r=dst IIS Stability: http://bugs.php.net/fix.php?id=40752&r=isapi Install GNU Sed: http://bugs.php.net/fix.php?id=40752&r=gnused Floating point limitations: http://bugs.php.net/fix.php?id=40752&r=float No Zend Extensions: http://bugs.php.net/fix.php?id=40752&r=nozend MySQL Configuration Error: http://bugs.php.net/fix.php?id=40752&r=mysqlcfg

« previous php.bugs (#110075) next »