|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
[2006-07-10 01:12 UTC] alex at thresholdstate dot com
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=\" } PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
|
|||||||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Sat Oct 25 07:00:02 2025 UTC |
Well..with current 5_2 version I get: array(2) { ["title"]=> string(23) "Best Scripting Language" ["desc"]=> string(42) "See <a href=\http://www.php.net/\>PHP</a>!" } although this not what you expect, is much better, since you can use str_replace() to replace backslashes with double quotes if you want.