ID: 38323
Updated by: [email]andrei@php.net[/email]
Reported By: zybersup at yahoo dot com
-Status: Assigned
+Status: Bogus
Bug Type: Unknown/Other Function
Operating System: Windows XP Professional
PHP Version: 4.4.3
Assigned To: andrei
New Comment:

Thank you for taking the time to write to us, but this is not
a bug. Please double-check the documentation available at
[url]http://www.php.net/manual/[/url] and the instructions on how to report
a bug at [url]http://bugs.php.net/how-to-report.php[/url]

The reason this happens is because BOM is immediately adjacent to the
"[Section 1]" portion. PHP 4 does not support Unicode. Thus, the parser
cannot parse that line properly and treats the entries in that section
as being global. You can either fix this by putting a newline before
[Section 1] or upgrading to PHP 6.


Previous Comments:
------------------------------------------------------------------------

[2006-08-05 06:29:49] zybersup at yahoo dot com

You can get the testing INI files from the same place of the testing
script.

[url]http://theguru.co.th/zybersup/test_utf8.ini[/url]
[url]http://theguru.co.th/zybersup/test_utf8bom.ini[/url]
[url]http://theguru.co.th/zybersup/test_utf8ascii.ini[/url]

------------------------------------------------------------------------

[2006-08-04 19:49:33] [email]andrei@php.net[/email]

Please provide access to the exact .ini file that is problematic. I
could not reproduce this on PHP 4 or 5.

------------------------------------------------------------------------

[2006-08-04 17:24:34] zybersup at yahoo dot com

Script to reproduce the bug
============================

<?

$dir = dirname(__FILE__) . '/';
$ascii = parse_ini_file($dir . 'test_ascii.ini', true);
$utf8bom = parse_ini_file($dir . 'test_utf8bom.ini', true);
$utf8 = parse_ini_file($dir . 'test_utf8.ini', true);
print_r($ascii);
print_r($utf8bom);
print_r($utf8);

?>

Unsatisfied Result
===================
(Don't worry about the value, just check the difference of array
structure)

Array
(
[Section1] => Array
(
[Aval] => ทดสอบ
ทดสอบ (Test Test)
[Bval] => ไทย
)

[Section2] => Array
(
[Cval] => Bar
[Dval] => Foo
)

)
Array
(
[Aval] =>
เธ—เธ”เธชเธญเธ�
เธ—เธ”เธชเธญเธ�
(Test Test)
[Bval] =>
เน�เธ—เธข
[Section2] => Array
(
[Cval] => Bar
[Dval] => Foo
)

)
Array
(
[Section1] => Array
(
[Aval] =>
เธ—เธ”เธชเธญเธ�
เธ—เธ”เธชเธญเธ�
(Test Test)
[Bval] =>
เน�เธ—เธข
)

[Section2] => Array
(
[Cval] => Bar
[Dval] => Foo
)

)

Try testing a demo at
[url]http://www.theguru.co.th/zybersup/test_parse_ini.php[/url]
(May not keep there more than 2 months)

------------------------------------------------------------------------

[2006-08-04 07:55:08] [email]tony2001@php.net[/email]

Thank you for this bug report. To properly diagnose the problem, we
need a short but complete example script to be able to reproduce
this bug ourselves.

A proper reproducing script starts with <?php and ends with ?>,
is max. 10-20 lines long and does not require any external
resources such as databases, etc.

If possible, make the script source available online and provide
an URL to it here. Try to avoid embedding huge scripts into the report.



------------------------------------------------------------------------

[2006-08-04 02:20:24] zybersup at yahoo dot com

Forgot to add more detail that...

I have tested files encoded in ASCII, UTF-8 w/ BOM and UTF-8 w/o BOM on
both PHP4 and PHP5 (5.0.5)
Found no problem with ASCII and UTF-8 w/o BOM. Only UTF-8 w/ BOM has
problem.
Also I found no problem with PHP 5.0.5. So that this problem should not
caused by my INI file, I guess ;).

------------------------------------------------------------------------

The remainder of the comments for this report are too long. To view
the rest of the comments, please view the bug report online at
[url]http://bugs.php.net/38323[/url]

--
Edit this bug report at [url]http://bugs.php.net/?id=38323&edit=1[/url]