From:             alex at thresholdstate dot com
Operating system: 
PHP version:      4.4.2
PHP Bug Type:     Unknown/Other Function
Bug description:  parse_ini_file() - escaping double quotes is impossible

Description:
------------
It appears there's no way a value in a .INI file can contain a double
quote character.

Backslash escaping is unsupported.  If some other escaping method is
available, the doc page doesn't mention it.

Example is taken from
http://www.php.net/manual/en/function.parse-ini-file.php#18216, posted in
January 2002.

C-style backslash escaping probably can't be supported due to Windows
paths.  Other escaping methods might be feasible: SQL-style doubled quote
characters, for example.

Reproduce code:
---------------
var_dump(parse_ini_file("example.ini"));

;============================
; Example Configuration File
;============================
[category]
title = "Best Scripting Language"
desc = "See <a href=\"http://www.php.net/\";>PHP</a>!"

Expected result:
----------------
array(2) {
  ["title"]=>
  string(23) "Best Scripting Language"
  ["desc"]=>
  string(13) "See <a href="http://www.php.net/";>PHP</a>!"
}


Actual result:
--------------
PHP Warning:  Error parsing a.ini on line 6
 in Command line code on line 1
array(2) {
  ["title"]=>
  string(23) "Best Scripting Language"
  ["desc"]=>
  string(13) "See <a href=\"
}


-- 
Edit bug report at http://bugs.php.net/?id=38052&edit=1
-- 
Try a CVS snapshot (PHP 4.4): 
http://bugs.php.net/fix.php?id=38052&r=trysnapshot44
Try a CVS snapshot (PHP 5.2): 
http://bugs.php.net/fix.php?id=38052&r=trysnapshot52
Try a CVS snapshot (PHP 6.0): 
http://bugs.php.net/fix.php?id=38052&r=trysnapshot60
Fixed in CVS:                 http://bugs.php.net/fix.php?id=38052&r=fixedcvs
Fixed in release:             
http://bugs.php.net/fix.php?id=38052&r=alreadyfixed
Need backtrace:               http://bugs.php.net/fix.php?id=38052&r=needtrace
Need Reproduce Script:        http://bugs.php.net/fix.php?id=38052&r=needscript
Try newer version:            http://bugs.php.net/fix.php?id=38052&r=oldversion
Not developer issue:          http://bugs.php.net/fix.php?id=38052&r=support
Expected behavior:            http://bugs.php.net/fix.php?id=38052&r=notwrong
Not enough info:              
http://bugs.php.net/fix.php?id=38052&r=notenoughinfo
Submitted twice:              
http://bugs.php.net/fix.php?id=38052&r=submittedtwice
register_globals:             http://bugs.php.net/fix.php?id=38052&r=globals
PHP 3 support discontinued:   http://bugs.php.net/fix.php?id=38052&r=php3
Daylight Savings:             http://bugs.php.net/fix.php?id=38052&r=dst
IIS Stability:                http://bugs.php.net/fix.php?id=38052&r=isapi
Install GNU Sed:              http://bugs.php.net/fix.php?id=38052&r=gnused
Floating point limitations:   http://bugs.php.net/fix.php?id=38052&r=float
No Zend Extensions:           http://bugs.php.net/fix.php?id=38052&r=nozend
MySQL Configuration Error:    http://bugs.php.net/fix.php?id=38052&r=mysqlcfg

Reply via email to