php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38732 Parse files with #'s in front of comments
Submitted: 2006-09-06 10:42 UTC Modified: 2015-05-05 17:10 UTC
Votes:1
Avg. Score:5.0 ± 0.0
Reproduced:1 of 1 (100.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: jm at powertrip dot co dot za Assigned: cmb (profile)
Status: Closed Package: *General Issues
PHP Version: 5.1.6 OS: Linux / Windows / FreeBSD
Private report: No CVE-ID: None
 [2006-09-06 10:42 UTC] jm at powertrip dot co dot za
Description:
------------
# php -q generate-dlr.php

Warning:  Error parsing *snip* on line 279 in *snip* on line 77
*snip*(77) : Warning - Error parsing *snip* on line 279

Reproduce code:
---------------
In /tmp/test.ini

;=======================================================================
; This is a comment
;=======================================================================

[test]
testing=test

#======================================================================
# This is another comment
#======================================================================

[foo]
foo=bar

And the following in /tmp/test.php

<?php
$ini = parse_ini_file("/tmp/test.ini", true);
print_r($ini);

Expected result:
----------------
Warning:  Error parsing /tmp/test.ini on line 8
 in /tmp/test.php on line 2
/tmp/test.php(2) : Warning - Error parsing /tmp/test.ini on line 8


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2011-09-19 14:02 UTC] technik at thomas-heuer dot eu
This is noted in the changelog for PHP 5.3.0:

"Hash marks (#) may no longer be used as comments and will throw a deprecation warning if used."

http://php.net/manual/en/function.parse-ini-file.php
 [2015-05-05 17:10 UTC] cmb@php.net
-Status: Open +Status: Closed -Package: Feature/Change Request +Package: *General Issues -Assigned To: +Assigned To: cmb
 [2015-05-05 17:10 UTC] cmb@php.net
Indeed, as of PHP 5.3 a deprecation warning is thrown.
 
PHP Copyright © 2001-2020 The PHP Group
All rights reserved.
Last updated: Sun Sep 20 18:01:26 2020 UTC